bumptech/montage — pull request #8 by edahlgren (2012-10-17 16:19:07+00:00)
Title: Reference Get implementation

* Implements references using regular buckets. How you ask?

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.

* Example of how to use/prove references -> examples/test_references.hs