curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject git commit: more doc
Date Sun, 23 Feb 2014 12:40:50 GMT
Repository: curator
Updated Branches:
  refs/heads/CURATOR-88 cde552f25 -> 9e041c771


more doc


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

Branch: refs/heads/CURATOR-88
Commit: 9e041c7710db892cea84ee1264fbda9ed62f5714
Parents: cde552f
Author: randgalt <randgalt@apache.org>
Authored: Sun Feb 23 18:10:42 2014 +0530
Committer: randgalt <randgalt@apache.org>
Committed: Sun Feb 23 18:10:42 2014 +0530

----------------------------------------------------------------------
 .../curator/x/rest/api/ClientResource.java      |  2 +-
 .../api/PersistentEphemeralNodeResource.java    |  3 +-
 .../x/rest/api/ReadWriteLockResource.java       | 23 ++++++++-------
 .../curator/x/rest/api/SemaphoreResource.java   |  3 +-
 .../src/site/confluence/apis.confluence         | 27 +++++++++++++++---
 .../src/site/confluence/entities.confluence     | 30 +++++++++++++++++++-
 6 files changed, 69 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/9e041c77/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/ClientResource.java
----------------------------------------------------------------------
diff --git a/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/ClientResource.java
b/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/ClientResource.java
index 49e3789..0b19e35 100644
--- a/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/ClientResource.java
+++ b/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/ClientResource.java
@@ -147,7 +147,7 @@ public class ClientResource
         return Response.ok().build();
     }
 
-    @PUT
+    @POST
     @Consumes(MediaType.APPLICATION_JSON)
     @Produces(MediaType.APPLICATION_JSON)
     @Path("/set-data")

http://git-wip-us.apache.org/repos/asf/curator/blob/9e041c77/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/PersistentEphemeralNodeResource.java
----------------------------------------------------------------------
diff --git a/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/PersistentEphemeralNodeResource.java
b/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/PersistentEphemeralNodeResource.java
index 9a30e0a..85d2c3f 100644
--- a/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/PersistentEphemeralNodeResource.java
+++ b/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/PersistentEphemeralNodeResource.java
@@ -25,6 +25,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
+import javax.ws.rs.POST;
 import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
@@ -44,7 +45,7 @@ public class PersistentEphemeralNodeResource
         this.context = context;
     }
 
-    @PUT
+    @POST
     @Consumes(MediaType.APPLICATION_JSON)
     @Produces(MediaType.APPLICATION_JSON)
     public Response start(final PersistentEphemeralNodeSpec spec) throws Exception

http://git-wip-us.apache.org/repos/asf/curator/blob/9e041c77/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/ReadWriteLockResource.java
----------------------------------------------------------------------
diff --git a/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/ReadWriteLockResource.java
b/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/ReadWriteLockResource.java
index 6ee70e7..fe5e319 100644
--- a/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/ReadWriteLockResource.java
+++ b/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/ReadWriteLockResource.java
@@ -27,6 +27,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
+import javax.ws.rs.POST;
 import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
@@ -47,7 +48,7 @@ public class ReadWriteLockResource
         this.context = context;
     }
 
-    @PUT
+    @POST
     @Consumes(MediaType.APPLICATION_JSON)
     @Produces(MediaType.APPLICATION_JSON)
     @Path("/read")
@@ -56,7 +57,7 @@ public class ReadWriteLockResource
         return internalLock(lockSpec, false);
     }
 
-    @PUT
+    @POST
     @Consumes(MediaType.APPLICATION_JSON)
     @Produces(MediaType.APPLICATION_JSON)
     @Path("/write")
@@ -65,6 +66,15 @@ public class ReadWriteLockResource
         return internalLock(lockSpec, true);
     }
 
+    @DELETE
+    @Path("{lock-id}")
+    public Response releaseLock(@PathParam("lock-id") String lockId) throws Exception
+    {
+        InterProcessMutex lock = Constants.deleteThing(context.getSession(), lockId, InterProcessMutex.class);
+        lock.release();
+        return Response.ok().build();
+    }
+
     private Response internalLock(final LockSpec lockSpec, boolean writeLock) throws Exception
     {
         InterProcessReadWriteLock lock = new InterProcessReadWriteLock(context.getClient(),
lockSpec.getPath());
@@ -96,13 +106,4 @@ public class ReadWriteLockResource
         ObjectNode node = Constants.makeIdNode(context, id);
         return Response.ok(context.getWriter().writeValueAsString(node)).build();
     }
-
-    @DELETE
-    @Path("{lock-id}")
-    public Response releaseLock(@PathParam("lock-id") String lockId) throws Exception
-    {
-        InterProcessMutex lock = Constants.deleteThing(context.getSession(), lockId, InterProcessMutex.class);
-        lock.release();
-        return Response.ok().build();
-    }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/9e041c77/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/SemaphoreResource.java
----------------------------------------------------------------------
diff --git a/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/SemaphoreResource.java
b/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/SemaphoreResource.java
index 2116866..41f6e2d 100644
--- a/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/SemaphoreResource.java
+++ b/curator-x-rest/src/main/java/org/apache/curator/x/rest/api/SemaphoreResource.java
@@ -28,6 +28,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
+import javax.ws.rs.POST;
 import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
@@ -60,7 +61,7 @@ public class SemaphoreResource
         this.context = context;
     }
 
-    @PUT
+    @POST
     @Consumes(MediaType.APPLICATION_JSON)
     @Produces(MediaType.APPLICATION_JSON)
     public Response acquireSemaphore(final SemaphoreSpec semaphoreSpec) throws Exception

http://git-wip-us.apache.org/repos/asf/curator/blob/9e041c77/curator-x-rest/src/site/confluence/apis.confluence
----------------------------------------------------------------------
diff --git a/curator-x-rest/src/site/confluence/apis.confluence b/curator-x-rest/src/site/confluence/apis.confluence
index e09fc4b..5da9e41 100644
--- a/curator-x-rest/src/site/confluence/apis.confluence
+++ b/curator-x-rest/src/site/confluence/apis.confluence
@@ -37,13 +37,32 @@ session length, the Curator REST Proxy will delete the ephemeral node
(sending a
 h2. Recipe APIs
 
 ||URL||Method||Request Entity||Response Entity||Description||
-|/curator/v1/recipes/lock|POST|LockSpec|IdSpec|An InterProcessSemaphoreMutex. On successful
return, your client will be holding the specified lock until you delete the lock via the delete
API.|
-|/curator/v1/recipes/lock/{lock-id}|DELETE|n/a|n/a|Release and delete a lock.|
+| *Leader* | | | | |
 |/curator/v1/recipes/leader|POST|LeaderSpec|IdSpec|Start a LeaderLatch instance. When you
gain leadership, it will be notified via status.|
 |/curator/v1/recipes/leader/{leader-id}|DELETE|n/a|n/a|Release/delete leadership.|
 |/curator/v1/recipes/leader/{leader-id}|GET|n/a|array of ParticipantSpecs|List of participants
in the leader election.|
-
-*MORE TBD*
+| *Lock* | | | | |
+|/curator/v1/recipes/lock|POST|LockSpec|IdSpec|An InterProcessSemaphoreMutex. On successful
return, your client will be holding the specified lock until you delete the lock via the delete
API.|
+|/curator/v1/recipes/lock/{lock-id}|DELETE|n/a|n/a|Release and delete a lock.|
+| *Read/Write Lock* | | | | |
+|/curator/v1/recipes/read-write-lock/read|POST|LockSpec|IdSpec|An InterProcessReadWriteLock.
On successful return, your client will be holding the specified read lock until you delete
the lock via the delete API.|
+|/curator/v1/recipes/read-write-lock/write|POST|LockSpec|IdSpec|An InterProcessReadWriteLock.
On successful return, your client will be holding the specified write lock until you delete
the lock via the delete API.|
+|/curator/v1/recipes/read-write-lock/{lock-id}|DELETE|n/a|n/a|Release and delete the read/write
lock.|
+| *Semaphore* | | | | |
+|/curator/v1/recipes/semaphore|POST|SemaphoreSpec|IdSpec|An InterProcessSemaphoreV2. On successful
return, your client will be holding the specified number of leases until you delete them via
the delete API.|
+|/curator/v1/recipes/semaphore/{lock-id}/{release-qty}|DELETE|n/a|n/a|Release the specified
number of leases.|
+| *Node Cache* | | | | |
+|/curator/v1/recipes/node-cache|POST|NodeCacheSpec|IdSpec|Start a NodeCache instance. NodeCache
updates will be notified via status.|
+|/curator/v1/recipes/node-cache/{cache-id}|GET|n/a|NodeData|Stop and delete a node cache.|
+|/curator/v1/recipes/node-cache/{cache-id}|DELETE|n/a|n/a|Stop and delete a node cache.|
+| *Path Cache* | | | | |
+|/curator/v1/recipes/path-cache|POST|PathChildrenCacheSpec|IdSpec|Start a PathChildrenCache
instance. PathChildrenCache updates will be notified via status.|
+|/curator/v1/recipes/path-cache/{cache-id}|GET|n/a|array of NodeData|Return the current cached
values.|
+|/curator/v1/recipes/path-cache/{cache-id}/{full-path}|GET|n/a|NodeData|Return the current
cached value for the node at the specified full path.|
+|/curator/v1/recipes/path-cache/{cache-id}|DELETE|n/a|n/a|Stop and delete a path cache.|
+| *Persistent Ephemeral Node* | | | | |
+|/curator/v1/recipes/persistent-ephemeral-node|POST|PersistentEphemeralNodeSpec|IdSpec|Start
a PersistentEphemeralNode instance.|
+|/curator/v1/recipes/persistent-ephemeral-node/{node-id}|DELETE|n/a|n/a|Stop and delete a
persistent ephemeral node.|
 
 h2. Entities
 

http://git-wip-us.apache.org/repos/asf/curator/blob/9e041c77/curator-x-rest/src/site/confluence/entities.confluence
----------------------------------------------------------------------
diff --git a/curator-x-rest/src/site/confluence/entities.confluence b/curator-x-rest/src/site/confluence/entities.confluence
index d1ce778..0537bde 100644
--- a/curator-x-rest/src/site/confluence/entities.confluence
+++ b/curator-x-rest/src/site/confluence/entities.confluence
@@ -80,6 +80,12 @@ Here are the entity descriptions for the entities used in the APIs:
 |path|string|The ZK path|
 |maxWaitMs|int|Maximum time to wait to acquire the lock (in milliseconds)|
 | | | |
+| *SemaphoreSpec* | | |
+|path|string|The ZK path|
+|maxWaitMs|int|Maximum time to wait to acquire the locks (in milliseconds)|
+|acquireQty|int|The number of leases to acquire|
+|maxLeases|int|The maximum number of leases allowed|
+| | | |
 | *LeaderSpec* | | |
 |path|string|The ZK path|
 |maxWaitMs|int|Maximum time to wait to acquire the lock (in milliseconds)|
@@ -87,7 +93,29 @@ Here are the entity descriptions for the entities used in the APIs:
 | *ParticipantSpec* | | |
 |participantId|string|The participant ID|
 |isLeader|boolean|true if this is the leader|
+| | | |
+| *NodeCacheSpec* | | |
+|path|string|The ZK path|
+|dataIsCompressed|boolean|if true if the data should be compressed|
+|buildInitial|boolean|if true if the initial data should be populated without sending notifications|
+| | | |
+| *NodeData* | | |
+|path|string|The ZK path|
+|stat|ZK Stat|the ZooKeeper stat for the node|
+|buildInitial|boolean|true if the initial data should be populated without sending notifications|
+|data|string|the data from the node|
+| | | |
+| *PathChildrenCacheSpec* | | |
+|path|string|The ZK path|
+|cacheData|boolean|if true to cache node data|
+|dataIsCompressed|boolean|if true data is compressed|
+|startMode|string|one of "normal", "build_initial_cache", or "post_initialized_event"|
+| | | |
+| *PersistentEphemeralNodeSpec* | | |
+|path|string|The ZK path|
+|data|string|The data to set in the node|
+|mode|string|Type of node to create. One of "ephemeral", "ephemeral_sequential", "protected_ephemeral",
"protected_ephemeral_sequential"|
 
 *NOTE* - for the entities above used in the Recipe APIs, not all combinations of values are
valid. For example,
-in the CreateSpec, withProtection and creatingParentsIfNeeded cannot be used together. The
rule is only combinations
+in the CreateSpec, withProtection and creatingParentsIfNeeded cannot be used together. Only
combinations
 that Curator itself supports can be used.
\ No newline at end of file


Mime
View raw message