MB-9307: Add find_header_bin/2

Make it possible to search for a header from a given position
backwards.

Change-Id: Id8254d2cdcce298fff964d576563ccb7383a461d
Reviewed-on: http://review.couchbase.org/29731
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Add v8 version detection to configure.ac

Detect if v8 version > 3.19 and define macro `V8_POST_3_19_API`

Change-Id: I8af6c5f9b83f977f414397833f320240f0eeca33
Reviewed-on: http://review.couchbase.org/30028
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-9482 Add support for V8 versions post 3.19

v8 versions post v3.19 does not allow copyable persistent objects
and few APIs have changed. Based on macro def `V8_POST_3_19_API`,
newer API or older API can be conditionally used.

Change-Id: I325d526eda9c0a9202809c003d6ea274447080bf
Reviewed-on: http://review.couchbase.org/30029
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Add V8 include path to CPPFLAGS

Without this change the header check would succeed only if another v8.h
is located in a standard header location (/usr/include, etc) or if the
environment variable C_INCLUDE_PATH was defined and pointing to the custom
location (which used to be my case). This ensures we can build when the
only v8.h is located in a custom path supplied by --with-v8-include.

Change-Id: I35acfb34d37fd5aea2b8cb119a22edb9d9e98d87
Reviewed-on: http://review.couchbase.org/30134
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
MB-8903: Add UPR project

In couch_upr will be all the code that is needed to get
changes from an UPR stream.

Change-Id: I1c71c64819e4369a38b32a20128e9d21fd7bd022
MB-8903: First version of couch_upr

See test/02-couch-upr.t for the API usage.

This commit also adds the fake UPR server.

Change-Id: I670f8e36196057399b4f942c7ffebfbdb9295066
MB-9058: Consume from fake UPR server

Instead of reading the changes from files, get them
via TCP from the fake UPR server.

Change-Id: If69433c4863de9a7ec2684da1c72d070c5406205
MB-9085: Don't hard-code UPR port

Instead of hard-coding the UPR port, use a configuration
setting for it. This makes it also possible to start the
fake UPR server on a random port (assigned by the
operating system), when the value is set to "0".

Hence it's now possible to run the set_view_tests in
parallel again.

Change-Id: I6c319dbb6fcac8b4f20f38ce8a44c6abed24658d
MB-9058: Remove all references to the database files

Access to the database files is no longer needed as
the information now gets in through the UPR stream.

A check for purging was removed. That is OK since with
UPR the logic to deal with purges needs to be re-done
anyway.

Change-Id: I3b751905867cda4453ebd98cbf48bd8144fbae0b
MB-8903: Update according to transfer protocol changes

The transfer protocol changed quite heavily. This commits
makes the corresponding changes.

Change-Id: I860b072c96258f3045a5fcc94b34eaa91f65f4f0
MB-8903: Switch defines from bytes to bits

Change-Id: Ic136a651c4e0f2563084b637693c9a25cd082cc6
MB-8903: Simplify header parsing

Change-Id: I9e24502b8aea7a589f1edbcc19c063cf9daa605c
Fix dialyzer warnings

Change-Id: I440acf09dc913f3b56b68f7ce3ce4077fda07da2
MB-9307: Add rollback to couch_upr

Add the rollback response to the couch_upr_fake_server when
the sequence number is too high. Also handle that case in
couch_upr.

Change-Id: Idf09828f29e6edc766d004a1f62f98f789d29f48
MB-8903: Update according to transfer protocol changes

Change-Id: I2ff866f228c72f6e7aa2763a6c1495a294afed88
MB-8903: Rename "stream start" to "stream request"

Align the names better with the specs and other implementations

Change-Id: Ib4fb81acbf859c6f82c8d42e5e4fad181172f544
MB-8903: Make function names more uniform

Remove "request" from encode_open_connection_request

Change-Id: I7343c3ac66af523afcf4d4692aed5a0214eb4a5a