Membase 2 Using with CouchDB
The following question applies to Membase backed by CouchDB (Membase 3?):
Does anybody know know what Java APIs will be updated to support membase/couchdb?
More specifically: if I have a CouchDB map function such as :
function(doc) {
if(doc.buyerId){
emit(doc.buyerId, doc);
}
}
Which emits Invoice json docs for each buyerId:
BUYER_00001 -> {_id:"xxxx", _re:"xxx", ...}
BUYER_00001 -> {_id:"xxxx", _re:"xxx", ...}
BUYER_00002 -> {_id:"xxxx", _re:"xxx", ...}
...
(note two invoices against BUYER_00001, and this is part of a view).
Can I access the JSON documents produced by a couchDB design document view via spymemcached?
e.g. How do I access a couchDB view via a membase java client such as spymemcached?
Or should I use something like ektorp?
Other thoughts:
Is the map function distributed across all nodes/buckets?
Will the get("BUYER_00001") client method return documents from all nodes?
Thanks
Adam
With spymemcached, we're planning to add a new CouchbaseClient object that has new view querying capabilities. This will let you create views that can do all kinds of powerful things, including secondary indexes over the data in a bucket. You'll be able to do things like query a view, and get a Map or Iterator over the results. Document fetches will flow through memcached protocol, so they'll be super fast, while view access will be over HTTP. Most of that is abstracted away for you. You just tell the client the name of a server or two, and the client does the rest.
I'll post an update soon, but this code should be up for review later today on review.couchbase.org.
Much more info will be available in the next week or two. We'll love to get your feedback!
Matt
Do you know if spymemcached and/or CouchbaseClient will do auto de/re serialization to and from Java object (such as with the Ektorp (if so will it be use the Jackson processor):
Company seller = createSeller();
couchDb.create(seller);
Company seller = couchDb.get(Company.class, "SELLER_00239787");
Company buyer = couchDb.get(Company.class, "BUY_0000001");
I'll take a look at your the review.couchbase.org code and give you some feedback. In the meantime I'm really looking forward to the added power and functionality.
Thanks
Adam
The model is slightly different, but that's certainly achievable.
By default, spymemcached stores things as serialized Java objects (if they're not String, integers and the like). That wouldn't allow you to define a view over it's elements though.
Spymemcached always allows you to define a transcoder though, so it should be straightforward to have the transcoder use the Jackson processor in a similar manner. This should work quite well, though use slightly more CPU for an obvious big gain in heterogeneous format and Couch views!
Thanks,
Matt
Hey Adam, we're in the process of updating spymemcached to support all the new functions of Couchbase Server 2.0 (the first integrated product). You will have access to all of this functionality within the new driver.
To your other questions:
-Yes, the map function (and reduce) will be distributed to all nodes...but I believe will be on a per-bucket basis
-I'll have to ask one of our SDK developers to chime in on the second, but I'm pretty sure that it will do what you want.
Sorry for being so short, I hope I answered your questions...or at least that I started to.
Forum support is great for free but sometimes you need a guaranteed response time and dedicated resources for your questions or issues.
Consider purchasing enterprise-level support from Couchbase: http://www.couchbase.com/products-and-services/overview
Call or email "sales -at- couchbase-dot- com" today!