curator
curator copied to clipboard
CURATOR-499 Allow creating sequential nodes with an empty name
Add CreateModable#withMode(CreateMode, PathEncodingType) where PathEncodingType is an enum with values DEFAULT and ALLOW_EMPTY.
When a node is created with ALLOW_EMPTY, trailing /s will not be removed from the path.
This should not be used except with sequential CreateModes, as it will fail with: java.lang.IllegalArgumentException: Path must not end with / character
Calling the following:
curatorFramework.create() .withMode(CreateMode.PERSISTENT_SEQUENTIAL, PathEncodingType.ALLOW_EMPTY) .forPath("/foo/bar/, data);
Will create a node "/foo/bar/000000000X", whereas calling:
curatorFramework.create() .withMode(CreateMode.PERSISTENT_SEQUENTIAL) .forPath("/foo/bar/, data);
Will create a node "/foo/bar000000000X".