Extracting data during link walking using PBC
russell.brown at me.com
Thu Apr 28 02:46:02 EDT 2011
I'm just working through this myself at the moment as I'm trying to make the Java PB client behave the same way as the REST client .
On 28 Apr 2011, at 04:23, OJ Reeves wrote:
> Hi everyone,
> I'm currently using Riak to store some user/account/oauth information and I have a need to pull some data while link-walking using the Erlang PBC.
> I have read the post on the Basho blog about how to do link walking using the REST API, and I can see that data for the individual nodes comes back as the nodes are being walked (by specifying 1 at the end of the URI). Unfortunately, after reading the docs, I can't see how to achieve the same result using the PBC. The samples demonstrate how to get information from the links using map/reduce, and I can see how I would use that information to hit Riak again and ask for the content.
> So my question: Is this how link walking should work when using the PBC? Or is there some way of getting the PBC to return the content at the same time as doing the link walking?
I asked yesterday and the answer I received was: no.
> In practice, what I have it a relationship between three entities (a, b and c) that live in different buckets (A, B and C). a has a link to b, and b has a link to c. What I want to do is walk from a to c while taking the following information:
> The value stored in a.
> The key of b and, if b still exists in B, the value stored in b, otherwise nothing/false/failure.
> The key of c and an indication of whether c currently exists in C.
> Currently I link walk and do each step manually and I was wondering if there was a better or more optimal way of performing these actions.
At the moment the plan is running an initial m/r job for the link phases then making a second m/r job with all the intermediate results as inputs. So maximum 2 jobs is my target.
I should think this is a common problem so if you come up with an optimal solution you'll make a few friends!
How do you satisfy your requirement with the REST link walker? Specifically how do you get the value of *a* returned as part of the result?
> I hope I'm clear!
> Many thanks for any insights you may have.
> Best regards
> OJ Reeves
> riak-users mailing list
> riak-users at lists.basho.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the riak-users