You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by marquiswang <gi...@git.apache.org> on 2019/01/10 17:56:31 UTC

[GitHub] curator pull request #300: CURATOR-499 Allow creating sequential nodes with ...

GitHub user marquiswang opened a pull request:

    https://github.com/apache/curator/pull/300

    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".

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/marquiswang/curator master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/curator/pull/300.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #300
    
----
commit df2ad2a27eeeb21a30dd1a7e9c05416d23b22d2a
Author: Marquis Wong <ma...@...>
Date:   2019-01-10T17:20:22Z

    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".

----


---