DESCRIPTION

JVMCBC-51: Move Observe utility class from java-client

Motivation
----------
Each wrapper of core-io library have to implement Observe polling
feature. This way is more error prone and harder to maintain good
quality of this implementation, which in fact will be shared.

Modification
------------
Pull Observe utility classe from java-client to core-io.

Result
------
Duplication reduced (considering java-client and jruby-client
libraries). Potentially expanded coverage for the Observe
implementation.

Blocks: http://review.couchbase.org/42363
Change-Id: I649a17202234a912222a3c52eab141feb141a8cd


COMMENTS

author: Cory Peck
date: 2014-10-23 07:10:01.392000000

Uploaded patch set 6.

-------------------------------------
author: Jasmin Rangel
date: 2014-10-23 07:10:01.838000000

Patch Set 6:

New patchset patch-id matches previous patchset, but commit message has changed.

-------------------------------------
author: Cory Peck
date: 2014-10-23 07:11:12.627000000

Patch Set 6: Verified+1

-------------------------------------
author: Estrella Humphrey
date: 2014-10-23 07:27:59.078000000

Patch Set 6:

why get rid of the PersistTo/ReplicateTo enums?

-------------------------------------
author: Cory Peck
date: 2014-10-23 07:31:01.535000000

Patch Set 6:

Because in java client they are part of the public API. So we cannot use enum in method signature, but just primitive numbers.

Other wrappers might implement them differently. For example in jruby they will be exposed using ruby symbols anyway, so I can convert symbols to numbers and pass to the core.

Leaving enums here only make sense when we will remove them in java-client, but we cannot do it because it is part of the public API right now

-------------------------------------
author: Estrella Humphrey
date: 2014-10-23 07:37:07.990000000

Patch Set 6:

I see, we're stuck with the enums in the java-client API for now... 
do we need a strategy to put them back into the core and replace any lang-specific symbols by the enum in the long term? (like mark both the jruby symbols and the java enums "deprecated, will be replaced by a core enum in following versions")?

-------------------------------------
author: Cory Peck
date: 2014-10-23 07:38:47.658000000

Patch Set 6:

I don't see any problem in having enums wrapping Observe.* constants

-------------------------------------
author: Estrella Humphrey
date: 2014-10-23 09:17:13.357000000

Patch Set 6: Code-Review+1

it's more about parameter safety for other implementations (or "power users") calling core. 

For instance, what's to prevent them to mix up the order of parameters, Observe.call(..., REPLICATE_TO_ONE, PERSIST_TO_MASTER) instead of Observe.call(..., PERSIST_TO_MASTER, REPLICATE_TO_ONE)?

admittedly core is closer to the metal where users should be extra careful, and alternatives are not more elegant...

I see two crude alternatives : 
 - duplicate the enums in core and make the java one wrap core enums instead of constants (possibly as an extra "asCore()" method on the enum)
 - break now, move the enum to core (a break of the API, but blatantly visible and easily fixed by a reorganize imports) -> it depends on the advertised stability of the 2.x API

Anyway, I guess I'll let michael jump in the conversation and give his advice...

+1 pending consensus on this ;)

-------------------------------------
author: Cory Peck
date: 2014-10-23 10:19:41.426000000

Patch Set 6:

I see your point, and it makes totally sense. I will update core lib

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