You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2014/06/07 20:19:32 UTC

[34/50] [abbrv] git commit: wip on doc

wip on doc


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

Branch: refs/heads/master
Commit: bfc388ce020afa62a6f5e1d6bd3c6cdd9a82e8a3
Parents: 48b0759
Author: randgalt <ra...@apache.org>
Authored: Sun Jun 1 13:14:49 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Sun Jun 1 13:14:49 2014 -0500

----------------------------------------------------------------------
 .../idl/services/CuratorProjectionService.java  | 15 ++++
 .../src/site/confluence/events.confluence       | 85 ++++++++++++++++++++
 2 files changed, 100 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/bfc388ce/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/services/CuratorProjectionService.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/services/CuratorProjectionService.java b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/services/CuratorProjectionService.java
index ca5a604..b9de507 100644
--- a/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/services/CuratorProjectionService.java
+++ b/curator-x-rpc/src/main/java/org/apache/curator/x/rpc/idl/services/CuratorProjectionService.java
@@ -314,6 +314,21 @@ public class CuratorProjectionService
     }
 
     @ThriftMethod
+    public void sync(CuratorProjection projection, String path, String asyncContext) throws RpcException
+    {
+        try
+        {
+            CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);
+            BackgroundCallback backgroundCallback = new RpcBackgroundCallback(this, projection);
+            entry.getClient().sync().inBackground(backgroundCallback, asyncContext).forPath(path);
+        }
+        catch ( Exception e )
+        {
+            throw new RpcException(e);
+        }
+    }
+
+    @ThriftMethod
     public boolean closeGenericProjection(CuratorProjection projection, String id) throws RpcException
     {
         try

http://git-wip-us.apache.org/repos/asf/curator/blob/bfc388ce/curator-x-rpc/src/site/confluence/events.confluence
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/site/confluence/events.confluence b/curator-x-rpc/src/site/confluence/events.confluence
index 416b978..a6df4e8 100644
--- a/curator-x-rpc/src/site/confluence/events.confluence
+++ b/curator-x-rpc/src/site/confluence/events.confluence
@@ -2,3 +2,88 @@
 
 h1. Events
 
+
+h2. Event Loop
+
+In order to receive out\-of\-bounds messages (connection state changes, watcher triggers, etc.) you must have an event loop to recieve
+messages from the EventService. Here is pseudo code:
+
+{code}
+inThread => {
+    while ( isOpen ) {
+        event = eventService.getNextEvent(curatorProjection)
+        ... process event ...
+    }
+}
+{code}
+
+h2. Schema
+
+h3. CuratorEvent
+
+||Field||Type||Description||
+|type|CuratorEventType|The event type|
+|resultCode|int|some event types have a result code (i.e. async API calls)|
+|path|string|if there is a path associated with the event|
+|context|string|async context for async API calls|
+|stat|Stat|some event types have a ZooKeeper Stat object|
+|data|bytes|ZNode data if the event type has it|
+|name|string|ZNode name if the event type has it|
+|children|list of string|list of node names if the event type has it|
+|aclList|list of Acl|list of ACL data if the event type has it|
+|watchedEvent|WatchedEvent|if the event type is WATCHED|
+|leaderEvent|LeaderEvent|if the event type is WATCHED|
+|childrenCacheEvent|PathChildrenCacheEvent|if the event type is PATH\_CHILDREN\_CACHE|
+
+h3. CuratorEventType
+
+||Value||Description||
+|PING|Returned if there no events have been generated within the [[configured|configuration.html]] pingTime|
+|CREATE|Async createNode() API completion|
+|DELETE|Async deleteNode() API completion|
+|EXISTS|Async exists() API completion|
+|GET\_DATA|Async getData() API completion|
+|SET\_DATA|Async setData() API completion|
+|CHILDREN|Async getChildren() API completion|
+|SYNC|Async sync() API completion|
+|WATCHED|A watcher has triggered|
+|CONNECTION\_CONNECTED|A Curator ConnectionStateListener is installed. This event is for the initial successful connection.|
+|CONNECTION\_SUSPENDED|A Curator ConnectionStateListener is installed. This event means the connection has been suspended.|
+|CONNECTION\_RECONNECTED|A Curator ConnectionStateListener is installed. This event means the connection has been reconnected.|
+|CONNECTION\_LOST|A Curator ConnectionStateListener is installed. This event means the connection has been lost.|
+|CONNECTION\_READ\_ONLY|A Curator ConnectionStateListener is installed. This event means the connection has changed to read only.|
+|LEADER|A Leader recipe event|
+|PATH\_CHILDREN\_CACHE|A path children cache event|
+|NODE\_CACHE|The node for a node cache has changed|
+
+h3. LeaderEvent
+
+||Field||Type||Description||
+|path|string|The leader's path|
+|participantId|string|The participant ID for the event being reported|
+|isLeader|bool|if true, this participant is being made leader. If false, it is losing leadership.|
+
+h3. PathChildrenCacheEvent
+
+||Field||Type||Description||
+|cachedPath|name|The path being cached|
+|type|PathChildrenCacheEventType|cache event type|
+|data|ChildData|data for the child ZNode|
+
+h3. PathChildrenCacheEventType
+
+Values:     CHILD\_ADDED,
+            CHILD\_UPDATED,
+            CHILD\_REMOVED,
+            CONNECTION\_SUSPENDED,
+            CONNECTION\_RECONNECTED,
+            CONNECTION\_LOST,
+            INITIALIZED
+
+h3. ChildData
+
+||Field||Type||Description||
+|path|string|The ZNode path|
+|stat|Stat|ZooKeeper Stat object|
+|data|bytes|ZNode data (if the cache is configured to cache data)|
+