You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by nicholas harteau <nr...@HEP.CAT> on 2011/03/23 16:30:13 UTC

O_CREAT-ishness

When writing software around zookeeper, I often find myself following
patterns similar to this:

  if( !zkh->set(node, foo)
    && zkh->get_error == ZNONODE)
  {
    zkh->create(node, foo)
  }

or, the converse:
  if( !zkh->create...

Has any thought been given to something like the old open(2) O_CREAT
flag for set and/or (I guess) O_TRUNC for create?

It seems like it would fit in nicely within the zookeeper philosophy,
similar to sequences.  I did a quick benchmark and those patterns are,
as expected, a little more than twice as slow as a single round-trip
call.

-- 
nrh@HEP.CAT l^o