You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@curator.apache.org by "evaristo.camarero@yahoo.es" <ev...@yahoo.es> on 2020/05/09 07:43:26 UTC

UTILITY TO HANDLE ZNODE PATHS WITH PROTECTED MODE

Hi there,

We are using Curator +Zookeeper in a manner that our ZNode paths contain meaningful information.

The model is like:

/root/report/


/root/report/R1

/root/report/R2

/root/report/R3

 

In several uses cases weare using PersistentNodes recipe (Ephemeral mode) to produce R1, R2 ...reports. Another process is watching all reports (via PathChildrenCache),and we are parsing the ZNode paths to determine the report numbering...

We are evaluating usingprotectedMode in the reports; protected mode is prefixing the ZNodenames ("_c_<UUID>"). Following previous example:


 

/root/report/

/root/report/_c_012-3238-323232-434354-R1

/root/report/_c_021-4239-523233-634355-R2

/root/report/_c_031-5230-623234-834356-R3

 

It is not a big deal toremove the prefix to parse the meaningful information (R1, R2...), but it wouldbe nice to be able to do that in a backwards compatible way and resilient to Curator updates.

An easy and generic wayto achieve this goal, is adding a public API that allows to determine if aZNode name is using Curator's protected mode, and another method able to removeprotected mode prefix from a given ZNode name. In myview CreateBuilderMain interface could be extended with default methodsable to do that. Notice that currently CreateBuilderImpl is the one having thelogic to generate the protectedMode path prefix, and probably that logic shouldbe also implemented (or at least specified) in interface in order to allow aconsistent behavior for different implementations.


What do you think? Doyou think is worthy to specify protectedModel prefixes format be and providemethods to handle with that?


Thanks in advance,


/Evaristo

Re: UTILITY TO HANDLE ZNODE PATHS WITH PROTECTED MODE

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
It's OK with me. Open an issue and create a PR.

-JZ

> On May 9, 2020, at 2:43 AM, evaristo.camarero@yahoo.es wrote:
> 
> Hi there,
> We are using Curator + Zookeeper in a manner that our ZNode paths contain meaningful information.
> 
> The model is like:
> 
> /root/report/
> /root/report/R1
> /root/report/R2
> /root/report/R3
>  
> In several uses cases we are using PersistentNodes recipe (Ephemeral mode) to produce R1, R2 ... reports. Another process is watching all reports (via PathChildrenCache), and we are parsing the ZNode paths to determine the report numbering...
> We are evaluating using protectedMode in the reports; protected mode is prefixing the ZNode names ("_c_<UUID>"). Following previous example:
>  
> /root/report/
> /root/report/_c_012-3238-323232-434354-R1
> /root/report/_c_021-4239-523233-634355-R2
> /root/report/_c_031-5230-623234-834356-R3
>  
> It is not a big deal to remove the prefix to parse the meaningful information (R1, R2...), but it would be nice to be able to do that in a backwards compatible way and resilient to Curator updates.
> An easy and generic way to achieve this goal, is adding a public API that allows to determine if a ZNode name is using Curator's protected mode, and another method able to remove protected mode prefix from a given ZNode name. In my view CreateBuilderMain interface could be extended with default methods able to do that. Notice that currently CreateBuilderImpl is the one having the logic to generate the protectedMode path prefix, and probably that logic should be also implemented (or at least specified) in interface in order to allow a consistent behavior for different implementations.
> What do you think? Do you think is worthy to specify protectedModel prefixes format be and provide methods to handle with that?
> Thanks in advance,
> /Evaristo