I'm in the process of migrating my code from Riak 1.4 to Riak 2.0.

In Riak 2.0, I'm storing binary data as a RiakObject:

RiakObject obj = new RiakObject();
   obj.setContentType(CONTENT_TYPE);
   obj.setValue(BinaryValue.create(someByteArray));
StoreValue op = new StoreValue.Builder(obj)
   .withLocation(new Location(ns, keyOfObject))
   .withOption(StoreValue.Option.RETURN_BODY, false)
   .build();

A siphash-digest is computed over the byte-array beforehand, and is
stored in a separate object in Riak (I call it 'manifest').

When fetching the binary data, I want to provide a custom
ConflictResolver. This resolver shall fetch the manifest to the binary
data, where it can look up the expected digest. This can then be used
for identifying and eliminating bad siblings. It can use the object's
key to identify the corresponding manifest.

My problem is: how does the conflict resolver know the key?

In Riak 1.4, I used IRiakObject to transport the data. The key was
available right on the IRiakObject:
public IRiakObject resolve(Collection<IRiakObject> siblings) {
    ...
    String key = siblings.iterator().next().getKey();
    ...
}

In Riak 2.0, the RiakObject does not expose this method. Is it
available maybe in the RiakUserMetadata ?

As an alternative, should I maybe create a POJO to encapsulate both
key (annotated with @RiakKey ?) and byte[]-data? I guess, I'd need a
custom converter for that, right?

Thanks,
Henning

-- 
My other signature is a regular expression.
http://www.pray4snow.de

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to