You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@curator.apache.org by Check Peck <co...@gmail.com> on 2015/09/09 04:03:23 UTC

find all the children which are x days old?

Is there any way we can find childrens of a given znode which is 30 days
old using curator? I mean the node which doesn't had any activity for last
30 days or X days.

    public List<String> getChildrenOfANode(final String path) throws
Exception {
        return client.getChildren().forPath(path);
    }

Re: find all the children which are x days old?

Posted by Cameron McKenzie <mc...@gmail.com>.
Yes, creation time and modification time. You presumably want to use
modification time.

On Wed, Sep 9, 2015 at 4:22 PM, Check Peck <co...@gmail.com> wrote:

> Yeah I looked at the Stat object. I saw two variables but there is no
> documentation in the code at all in Stats class.
>
> long ctime,
> long mtime,
>
> What is the difference between these two? From the names, ctime is the
> created time and mtime is the modified time and I should be using mtime
> right?
>
>
> On Tue, Sep 8, 2015 at 11:07 PM, Jordan Zimmerman <
> jordan@jordanzimmerman.com> wrote:
>
>> You can use PathChildrenCache or TreeCache. These classes cache trees of
>> ZNodes. You can then iterate over each node and look at the Stat object.
>> One of the Stat object’s fields has the value you want (I forget which).
>>
>> -JZ
>>
>>
>> On September 8, 2015 at 9:03:49 PM, Check Peck (comptechgeeky@gmail.com)
>> wrote:
>>
>> Is there any way we can find childrens of a given znode which is 30 days
>> old using curator? I mean the node which doesn't had any activity for last
>> 30 days or X days.
>>
>>     public List<String> getChildrenOfANode(final String path) throws
>> Exception {
>>         return client.getChildren().forPath(path);
>>     }
>>
>>
>

Re: find all the children which are x days old?

Posted by Check Peck <co...@gmail.com>.
Yeah I looked at the Stat object. I saw two variables but there is no
documentation in the code at all in Stats class.

long ctime,
long mtime,

What is the difference between these two? From the names, ctime is the
created time and mtime is the modified time and I should be using mtime
right?


On Tue, Sep 8, 2015 at 11:07 PM, Jordan Zimmerman <
jordan@jordanzimmerman.com> wrote:

> You can use PathChildrenCache or TreeCache. These classes cache trees of
> ZNodes. You can then iterate over each node and look at the Stat object.
> One of the Stat object’s fields has the value you want (I forget which).
>
> -JZ
>
>
> On September 8, 2015 at 9:03:49 PM, Check Peck (comptechgeeky@gmail.com)
> wrote:
>
> Is there any way we can find childrens of a given znode which is 30 days
> old using curator? I mean the node which doesn't had any activity for last
> 30 days or X days.
>
>     public List<String> getChildrenOfANode(final String path) throws
> Exception {
>         return client.getChildren().forPath(path);
>     }
>
>

Re: find all the children which are x days old?

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
You can use PathChildrenCache or TreeCache. These classes cache trees of ZNodes. You can then iterate over each node and look at the Stat object. One of the Stat object’s fields has the value you want (I forget which).

-JZ

On September 8, 2015 at 9:03:49 PM, Check Peck (comptechgeeky@gmail.com) wrote:

Is there any way we can find childrens of a given znode which is 30 days old using curator? I mean the node which doesn't had any activity for last 30 days or X days.

    public List<String> getChildrenOfANode(final String path) throws Exception {
        return client.getChildren().forPath(path);
    }