Skip to content

Instantly share code, notes, and snippets.

@bkerley
Created February 12, 2015 13:22
Show Gist options
  • Save bkerley/e81567ad4fea9e83532d to your computer and use it in GitHub Desktop.
Save bkerley/e81567ad4fea9e83532d to your computer and use it in GitHub Desktop.
RFC: Yokozuna and CRDTs in Ruby
# the nice thing about this improved yz api is that it's not released yet! i can
# do anything, i'm the master of time!
# this is how we search pretty much anything
query = Riak::Search::Query.new client, index, 'cool search term'
results = query.results # actually hits riak, gives us a ResultsCollection
# existing robject functionality
robject_md = results.docs[0]
# equivalent
robject = robject_md.robject
robject = results[0]
# perhaps?
robject = results.robjects[0]
# result.docs is a collection of ResultsDocuments, each of which is a hash
# from the yz results
map_md = results.docs[1]
# call out to riak and load that map
map = map_md.map
map = results.maps.first
# raise an error
set = map_md.set
# raise an error?
robject = map_md.robject
@christophermancini
Copy link

I think results.robjects[0] seems reasonable as it is consistent with the docs interface.

@christophermancini
Copy link

Fetching maps this way seems good to me as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment