bumptech / montage

Riak resolution proxy
Other
27 stars 6 forks source link

Reference Get implementation #8

Closed edahlgren closed 12 years ago

edahlgren commented 12 years ago

The idea is that any bucket's data (defined via a resolution object) can have a reference key. So if you have a protocol buffer with several fields in "x" bucket, you could choose one field (perhaps an int field) as the reference key and this field will be used as the key for the next get request.

So for each res object you define a referenceKey method along with a getPB BucketSpec which obtains from the stored object a serialized key. The ChainReference command then only needs to obtain this key (via the typeclass) and perform another ChainGet.

What's nice is that if there's no corresponding value -> key relationship between two buckets, you define this referenceKey as Nothing and the ChainReference command behaves as if it didn't find anything in Riak. So when receiving data, it's a unified Maybe (MontageObject), like regular gets.