Question about vclock and HTTP put.

Justin Sheehy justin at basho.com
Wed Jan 6 09:11:39 EST 2010


On Tue, Jan 5, 2010 at 8:15 PM, Ken Sedgwick <ksedgwic at bonsai.com> wrote:

> Greetings!

Hi, Ken!

> I'm not sure how to specify the vclock

> I'm currently adding a vclock field to the JSON value that I put:

> Is this the correct thing to do?  I've noticed the material referring
> to a X-Riak-Vclock HTTP header on the web.  Is this a better route?

First, I strongly suggest that you use the "raw" HTTP interface
instead of Jiak.  Though Jiak has been around longer and is a bit more
documented, they work almost exactly the same with the following
differences:

- Jiak uses a default URL prefix of "/jiak" and Raw uses a default
prefix of "/raw"

- Jiak inspects the contents of the document and validates the JSON,
Raw is content-blind.

- If you want to specify document links, you should do it via the Link
header instead of in the body.

The raw interface is faster and simpler.

(now, on to your actual question!)

You should, when doing a PUT to update a Riak document, include an
X-Riak-Vclock header that has the same value that the object you are
modifying included in its X-Riak-Vclock header upon GET.  Does that
make sense?

> What is the vtag for?  Do I need to do anything with it?

The only real use of the vtag is if you have a document with
"siblings" (write-conflicts) and you want to request a specific one of
the multiple values in that object.  Most of the time you can happily
ignore the vtags.

I hope that this is helpful.

Best,

-Justin




More information about the riak-users mailing list