Hi Mikl,

Thanks for the test case - it's definitely a bug in the PB client. I'll file a bug for you and work on a fix as soon as I have a chance.

Jon

On 5/26/10 5:45 AM, Mikl Kurkov wrote:
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


_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to