You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@curator.apache.org by Techy Teck <co...@gmail.com> on 2013/11/13 07:47:22 UTC

Active Children nodes?

Suppose I have this hierarchy in my zookeeper schema. Attached is the
diagram.



And there will be some children for /v1 and /v2 as well.


At some stage, I will be trying to retrieve children of /root parent node.
And depending on whether /v1 is active or /v2 is active, we will retrieve
its children.
Suppose if /v1 is active, then we will retrieve children of v1 and if v2 is
active, then we will retrieve children of v2.

Now I am wondering, how to add this active(ness) as a part of znode?
Meaning how to make sure any one node is active at certain point so that
when I retrieve the children of root, I can tell which version is active
and then get the children of those version (v1 or v2) node

Initially, I was thinking to add some data in /v1 and /v2 node which will
tell us which node is active from v1 and v2.

But is there any other approach that I can use here?

Re: Active Children nodes?

Posted by Cameron McKenzie <mc...@gmail.com>.
You would need to add the 'active' flag to the data in the zNode (v1 or
v2). Then you would place a watch on the data changing in those zNodes
(i.e. curator.getData().watched().forPath("bla")); Then you would get
notified whenever a node become active or inactive.

You're responsible for encoding the active flag into the zNode, as it just
takes a byte[] as the data to be stored.


On Thu, Nov 14, 2013 at 4:44 AM, Techy Teck <co...@gmail.com> wrote:

> Any suggestion on this?
>
>
> On Tue, Nov 12, 2013 at 10:47 PM, Techy Teck <co...@gmail.com>wrote:
>
>> Suppose I have this hierarchy in my zookeeper schema. Attached is the
>> diagram.
>>
>>
>>
>> And there will be some children for /v1 and /v2 as well.
>>
>>
>> At some stage, I will be trying to retrieve children of /root parent
>> node. And depending on whether /v1 is active or /v2 is active, we will
>> retrieve its children.
>> Suppose if /v1 is active, then we will retrieve children of v1 and if v2
>> is active, then we will retrieve children of v2.
>>
>> Now I am wondering, how to add this active(ness) as a part of znode?
>> Meaning how to make sure any one node is active at certain point so that
>> when I retrieve the children of root, I can tell which version is active
>> and then get the children of those version (v1 or v2) node
>>
>> Initially, I was thinking to add some data in /v1 and /v2 node which will
>> tell us which node is active from v1 and v2.
>>
>> But is there any other approach that I can use here?
>>
>
>

Re: Active Children nodes?

Posted by Techy Teck <co...@gmail.com>.
Any suggestion on this?


On Tue, Nov 12, 2013 at 10:47 PM, Techy Teck <co...@gmail.com>wrote:

> Suppose I have this hierarchy in my zookeeper schema. Attached is the
> diagram.
>
>
>
> And there will be some children for /v1 and /v2 as well.
>
>
> At some stage, I will be trying to retrieve children of /root parent node.
> And depending on whether /v1 is active or /v2 is active, we will retrieve
> its children.
> Suppose if /v1 is active, then we will retrieve children of v1 and if v2
> is active, then we will retrieve children of v2.
>
> Now I am wondering, how to add this active(ness) as a part of znode?
> Meaning how to make sure any one node is active at certain point so that
> when I retrieve the children of root, I can tell which version is active
> and then get the children of those version (v1 or v2) node
>
> Initially, I was thinking to add some data in /v1 and /v2 node which will
> tell us which node is active from v1 and v2.
>
> But is there any other approach that I can use here?
>