Updating metadata with Erlang PBC

Mikl Kurkov mkurkov at gmail.com
Wed May 26 07:45:35 EDT 2010


Hi!

It seems that protobuffers client doesn't allow to update metadata of
object.

Example: 

<code>
-module(test).
-compile(export_all).

test1(Host, Port) ->
    {ok,C} = riakc_pb_socket:start_link(Host, Port),
    O0 = riakc_obj:new(<<"b">>, <<"k">>, <<"d">>),
    {ok, O1} = riakc_pb_socket:put(C, O0, [return_body]),
    M1 = riakc_obj:get_metadata(O1),
    M2 = dict:store(<<"Links">>, [{{<<"b">>, <<"k1">>}, <<"t1">>}], M1),
    O2 = riakc_obj:update_metadata(O1, M2),
    riakc_pb_socket:put(C, O2).

</code>

Runnig test:test1("localhost", 8081), I see error 
{error,{required_field_is_undefined,1,bytes}}.

After tracing I realised that missing field is Value from RpbContent
structure. 
So updating value with riakc_obj:update_value/2  before calling put does the
trick. 
But I think metadata supposed to be updated without need of updating value.

--
Mikl
-- 
View this message in context: http://riak-users.197444.n3.nabble.com/Updating-metadata-with-Erlang-PBC-tp844697p844697.html
Sent from the Riak Users mailing list archive at Nabble.com.




More information about the riak-users mailing list