It seems like the multi-txn API might be helpful here. Since each path is of known length, you could have a multi-op query that is
get(/a/b/c/d), get(/a/b/c), get(/a/b), get(/a) and then check the results of each in order. Henry On 21 February 2012 16:45, Shelley, Ryan <[email protected]> wrote: > Hi folks. Very new to ZooKeeper and evaluating it for a project. The ZK > directory-like layout is perfect for what I'm working on, for record > storage, with one caveat. I'm curious if there's a way to set it up to > return default records in the event a specific record isn't available (I'm > attempting to reduce the number of round-trips to retrieve some data). > > For example: > > I create a node named "foo" with the data "lorem_ipsum": > create /foo lorem_ipsum > > Then I create a node named "bar" under "foo" with the data "baz": > create /foo/bar baz > > If I get "/foo/bar" obviously I'll get "baz", however, if I try to get > "/foo/blah" I'd like to get "lorem_ipsum." I know this is highly suspect as > a design pattern, but there's a method to the madness. We want to create > records that can be overridden by sub-records (like "/foo/bar"), but in the > event that sub-record doesn't exist, I'd get back the next concrete record. > > Any thoughts? Thanks! > > -Ryan > -- Henry Robinson Software Engineer Cloudera 415-994-6679
