riakc doesn't save metadata properly?

David Parfitt dparfitt at basho.com
Mon Oct 22 17:08:00 EDT 2012


Hello Metin -

  Sorry for the delay. At the moment, all metadata needs to be stored
under the <<"X-Riak-Meta">> dict key. The following example
illustrates how this works:

%% To store metadata:
Object = riakc_obj:new(<<"groceries">>, <<"mine">>, <<"eggs & bacon">>).
MetaData  = dict:from_list([{<<"X-Riak-Meta">>, [{"Foo", "Bar"}]}]),
Object2 = riakc_obj:update_metadata(Object, MetaData).
riakc_pb_socket:put(Pid, Object2).

%% To retrieve metadata:
{ok, O} = riakc_pb_socket:get(Pid, <<"groceries">>, <<"mine">>).
{ok, MD} = dict:find(<<"X-Riak-Meta">>, riakc_obj:get_metadata(O)).

We're kicking around ways to improve this in the future.

Cheers -
Dave

On Fri, Oct 19, 2012 at 8:31 AM, Metin Akat <akat.metin at gmail.com> wrote:
> I am trying to do something like:
>
>     Meta1 = dict:store(<<"ver">>, Ver, Meta0),
>     Obj1 = riakc_obj:update_metadata(Obj, Meta1),
>
> and then save the object. But on a subsequent read, the metadata k/v pair is
> not there.
>
> Is there anything special that needs to be done for this to work, or is this
> illegal way to use Riak?
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>




More information about the riak-users mailing list