MB-9307: Add typespecs to newly added functions

Change-Id: I7d48215ef6fb760236446f5bfb4006075ba092d9
Reviewed-on: http://review.couchbase.org/30958
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Sarath Lakshman <sarathlakshman@slynux.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
MB-8903: Stream Request OK response returns Failover Log

Change-Id: I2b940b8c62a31f741bcbfab7604c897b9859f345
MB-8903: Make use of Partition Version

Prior to this commit the Partition Version wasn't taken
into account, now it is.

Please note that only couch_upr was updated, the tests
in couch_set_view are expected to fail (until the next
commit).

Change-Id: I87704c2babcf10fffb1629b9eb9599d4bb99df5e
MB-9666: Persist and use Partition Versions/Failover Log

The Failover Log that is returned by the Stream Request OK
response is now used in the view group and also persisted
in the header on disk.

"make check" in couch_set_view passes again.

Change-Id: I950a102e18ab4223908c4b42f962d4a742840988
MB-8903: Open stream to producer *not* consumer

Change-Id: Ie195016f3facf890a16639424f1e5175e5ad5c23
MB-8903: Upper bound for Request ID can be higher

Change-Id: Iefc18684902ed46b5eddc242403ee2e91a0e4a37
MB-8903: Return error when there's no Failover Log

If you want to receive a Failover Log (e.g. in an Stream
Request OK Response) and there is none, return an
'no_failover_log_found' error.

Change-Id: I88bb185e52c642490aed04d0e99ed9552e317814
MB-8903: Get high sequence number as stat

Instead of getting it from the fake UPR server directly via
a function call, request it via a stat request. This currently
doesn't work with the real ep-engine implementation, as you
can't request a stat from a socket that is connected to an
UPR stream. You would need to open a separate socket.

As this still needs to discussed, the simplest possible way
(using the UPR stream socket also for stats) is used until
an agreement is found.

The 03-fake-upr-server.t tests are removed as all it's
functionality is testes with the 02-couch-upr.t tests anyway.

Change-Id: I0ae7bf74c71e2cc65702ce379458339b70f518c3
Merge remote-tracking branch 'couchbase/master' into upr

Change-Id: I6ff10babb02117bdae72abe670fcc5652013bb2f
MB-9307: Use the partition versions from the on disk header

After a rollback the partition versions of the header it
was rolled back to must be used.

Also return the new partition versions on the 'ok' response.

Change-Id: Ie0e8384da4f66cb76cb77eb6a93918416457da9a
Make it possible to reset couch_upr_fake_server

For testing it is needed to reset the state of the
couch_upr_fake_server.

Change-Id: I3f6d6b58b7a67bff970274dd6075adc67aad491d
MB-9307: Handle rollback properly in fake UPR server

Change-Id: Ie65ee4f36d220deba979b673f5d15fc59e39b80b
MB-8903: Supply full failover log to enum_docs_since/7

Instead of supplying just the most recent partition version,
supply the full failover log. This way the `enum_docs_since`
can retry with different partition versions.

Change-Id: I2d85def31a094998268f4cceec7dc03944c22ef0
MB-9307: Make rollback/2 an internal function call

`couch_set_view_updater:rollback/2` won't be called from the
outside, but just within the group.

Change-Id: I33cf920eb6293c0647a09b424ed082dd54f99802
MB-9307: Refactor resetting of group

Refactor the resetting of a group based on a state. This
is needed by the next commit.

Change-Id: I5f92fa22522e174fa1ab9bc9658b79845e5512ef
MB-9307: Implement rollback in updater

The rollback is now part of the updater. When the updater receives
a rollback response during the doc loading, it will keep going in
order to get possible rollbacks of other partitions.

Once all partitions have been processed the doc loader will throw
an rollback error, which will make the updater exit. The view group
will then catch this exit and do the rollback.

Afterwards the updater will be restarted and should now process
the original request as expected.

Change-Id: I3e92643fc29c1481fcb6c18c89cb6eb3f0b0f846