Hi Mahadev,

Yes, you're right, the approach is similar to the File API. Although, I'm
trying to make it easier in a few spots. For example, deleting a Node
recursively is done by default. I also lean toward resolving Exceptions
"under the hood" when it seems appropriate. For example, if you ask a Node
if it exists, and its parent doesn't even exist, you just get a false back
(rather than a nasty Exception).

As for watches and ephemeral nodes, my current work does not need these
things so I currently have no handling of them. But if potential users of
the "Node a.k.a. File" design want these things, I'd be open to supporting
them as reasonable. Do you think the "Node a.k.a. File" design approach
would be compatible with these things? What would you suggest?


On Tue, Feb 16, 2010 at 10:13 AM, Mahadev Konar <maha...@yahoo-inc.com>wrote:

> Hi Aaron,
>  This looks like more of a File API of java :). I think it would be useful.
> It does seem useful for some kind of group membership using ZooKeeper. You
> just need to be a little careful about handling watches and ephemeral nodes
> with such design. How do you plan to handle it?
> Thanks
> mahadev
> On 2/13/10 12:50 PM, "Aaron Crow" <dirtyvagab...@yahoo.com> wrote:
> > Dear ZooKeepers,
> >
> > We recently integrated ZooKeeper into our Java project at work. This is a
> > very cool project... I feel like a kid with a new toy. After using the
> Java
> > API a little, I've begun to create some simple wrappers around the main
> > ZooKeeper object.
> >
> > Specifically, I'm creating a simple Node design, that makes it simpler
> and
> > more convenient for me to do simple management of my ZooKeeper node
> state.
> > Just as a rough idea:
> >
> > Node node = myZk.getNode(path);
> > if(node.exists()){
> >   String data = node.getData();
> >   Collection<Node> children = node.getChildren();
> >   node.delete();
> > }
> >
> > I was wondering... am I re-inventing the wheel here (did I miss any
> existing
> > API like this)? Or if not, would the community have any interest if I
> wanted
> > to add this into the main project?
> >
> > Many thanks in advance for any insights or guidance...
> >
> >
> > All the best,
> > Aaron

Reply via email to