curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dragonsi...@apache.org
Subject curator git commit: Smarter path fixing for create sequential.
Date Thu, 08 Jan 2015 05:42:22 GMT
Repository: curator
Updated Branches:
  refs/heads/CURATOR-179 3a327efaf -> 909860665


Smarter path fixing for create sequential.


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/90986066
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/90986066
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/90986066

Branch: refs/heads/CURATOR-179
Commit: 909860665bd3b61e32ab5f72d4100c5b380ea970
Parents: 3a327ef
Author: Scott Blum <dragonsinth@apache.org>
Authored: Thu Jan 8 00:42:04 2015 -0500
Committer: Scott Blum <dragonsinth@apache.org>
Committed: Thu Jan 8 00:42:04 2015 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/curator/utils/ZKPaths.java  | 15 ++++++++++++++-
 .../curator/framework/imps/CreateBuilderImpl.java    |  2 +-
 .../curator/framework/imps/CuratorFrameworkImpl.java |  7 ++++++-
 .../curator/framework/imps/NamespaceFacade.java      |  8 +++++++-
 .../apache/curator/framework/imps/NamespaceImpl.java |  6 +++---
 5 files changed, 31 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/90986066/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java b/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
index 352bfd6..155038d 100644
--- a/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
+++ b/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
@@ -40,8 +40,21 @@ public class ZKPaths
      */
     public static String fixForNamespace(String namespace, String path)
     {
+        return fixForNamespace(namespace, path, false);
+    }
+
+    /**
+     * Apply the namespace to the given path
+     *
+     * @param namespace    namespace (can be null)
+     * @param path         path
+     * @param isSequential if the path is being created with a sequential flag
+     * @return adjusted path
+     */
+    public static String fixForNamespace(String namespace, String path, boolean isSequential)
+    {
         // Child path must be valid in and of itself.
-        PathUtils.validatePath(path);
+        PathUtils.validatePath(path, isSequential);
 
         if ( namespace != null )
         {

http://git-wip-us.apache.org/repos/asf/curator/blob/90986066/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
index d74cc56..5244d04 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
@@ -431,7 +431,7 @@ class CreateBuilderImpl implements CreateBuilder, BackgroundOperation<PathAndByt
             data = client.getCompressionProvider().compress(givenPath, data);
         }
 
-        final String adjustedPath = adjustPath(client.fixForNamespace(givenPath));
+        final String adjustedPath = adjustPath(client.fixForNamespace(givenPath, createMode.isSequential()));
 
         String returnPath = null;
         if ( backgrounding.inBackground() )

http://git-wip-us.apache.org/repos/asf/curator/blob/90986066/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index cf38e21..bb1de0f 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -586,7 +586,12 @@ public class CuratorFrameworkImpl implements CuratorFramework
 
     String fixForNamespace(String path)
     {
-        return namespace.fixForNamespace(path);
+        return namespace.fixForNamespace(path, false);
+    }
+
+    String fixForNamespace(String path, boolean isSequential)
+    {
+        return namespace.fixForNamespace(path, isSequential);
     }
 
     byte[] getDefaultData()

http://git-wip-us.apache.org/repos/asf/curator/blob/90986066/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
index 818fe5f..3f24c79 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
@@ -133,7 +133,13 @@ class NamespaceFacade extends CuratorFrameworkImpl
     @Override
     String fixForNamespace(String path)
     {
-        return namespace.fixForNamespace(path);
+        return namespace.fixForNamespace(path, false);
+    }
+
+    @Override
+    String fixForNamespace(String path, boolean isSequential)
+    {
+        return namespace.fixForNamespace(path, isSequential);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/curator/blob/90986066/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceImpl.java
b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceImpl.java
index 3fc8e80..717b2f4 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceImpl.java
@@ -65,7 +65,7 @@ class NamespaceImpl
         return path;
     }
 
-    String    fixForNamespace(String path)
+    String    fixForNamespace(String path, boolean isSequential)
     {
         if ( ensurePath != null )
         {
@@ -79,11 +79,11 @@ class NamespaceImpl
             }
         }
 
-        return ZKPaths.fixForNamespace(namespace, path);
+        return ZKPaths.fixForNamespace(namespace, path, isSequential);
     }
 
     EnsurePath newNamespaceAwareEnsurePath(String path)
     {
-        return new EnsurePath(fixForNamespace(path), client.getAclProvider());
+        return new EnsurePath(fixForNamespace(path, false), client.getAclProvider());
     }
 }


Mime
View raw message