DESCRIPTION

Implement a dynamic stateful zipper.

Motivation
----------
There is the Observable.zip() functionality available, but it does not work
on a changing set of incoming streams. We need this functionality because
sources like endpoints (or nodes) can come and go.

Modifications
-------------
The StateZipper (and its abstract implementation) needs to be extended to be
actually useful. The implementing class needs to provide an "empty state"
as well as the zip function.

The zipper statefully manages registrations, merges the streams and call the
zip function every time one of the states changes (with a collection of all
currently set states). The zip function then reduces it to one state and
returns it. This new state is the global state of the zipper, where
other parties can subscribe to.

Result
------
A self containted stateful implementation of a dynamic zipper that can and
will be reused in some places in the core.

Change-Id: Ib293c950e45e1d602f414e53935504321f4ac11a
Reviewed-on: http://review.couchbase.org/45736
Reviewed-by: Estrella Humphrey xxx@xxx.xxx
Tested-by: Natasha Sullivan xxx@xxx.xxx


COMMENTS

author: Natasha Sullivan
date: 2015-01-22 14:54:40.660000000

Change has been successfully cherry-picked as 52303c93178661961da5a72ccabf9c5bffc87a26

-------------------------------------
