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 2017/08/11 02:03:10 UTC

curator git commit: all other caches are deprecated - main doc reflects that. Wrote a new doc for CuratorCache

Repository: curator
Updated Branches:
  refs/heads/persistent-watch 451add4cb -> 9a05598c4


all other caches are deprecated - main doc reflects that. Wrote a new doc for CuratorCache


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

Branch: refs/heads/persistent-watch
Commit: 9a05598c4d09c360e64db46b7e061e55fcfcad1f
Parents: 451add4
Author: randgalt <ra...@apache.org>
Authored: Thu Aug 10 21:03:05 2017 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu Aug 10 21:03:05 2017 -0500

----------------------------------------------------------------------
 .../site/confluence/curator-cache.confluence    | 54 +++++++++++++++++
 .../src/site/confluence/index.confluence        |  6 +-
 .../src/site/confluence/node-cache.confluence   | 35 -----------
 .../src/site/confluence/path-cache.confluence   | 61 --------------------
 .../src/site/confluence/tree-cache.confluence   | 39 -------------
 5 files changed, 56 insertions(+), 139 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/9a05598c/curator-recipes/src/site/confluence/curator-cache.confluence
----------------------------------------------------------------------
diff --git a/curator-recipes/src/site/confluence/curator-cache.confluence b/curator-recipes/src/site/confluence/curator-cache.confluence
new file mode 100644
index 0000000..7cac045
--- /dev/null
+++ b/curator-recipes/src/site/confluence/curator-cache.confluence
@@ -0,0 +1,54 @@
+h1. Curator Cache
+
+h2. Description
+A utility to watch a single ZNode, children of a ZNode or an entire tree of ZNodes. The cache will watch the node(s), respond to update/create/delete events, pull
+down the data, etc. You can register a listener that will get notified when changes occur.
+
+h2. Participating Classes
+* CuratorCache
+* CacheListener
+* CachedNode
+* CachedNodeMap
+* CuratorCacheBuilder
+
+h2. Usage
+
+h3. Creating a CuratorCache
+{code}
+public CuratorCacheBuilder.builder(CuratorFramework client,
+                         String path)
+Parameters:
+client - the client
+path - path to watch
+{code}
+
+Once you have a builder instance, set any options/features and then call {{build()}} to get the
+CuratorCache instance.
+
+h2. General Usage
+The cache must be started by calling {{start()}}. Call {{close()}} when you are through with the cache.
+
+At any time, call {{view()}} to get the current state of the cache or call {{get()}} to get the
+cached value of a specific ZNode.
+
+You can register to be notified when a change occurs by calling {{getListenable()}} and then:
+
+{code}
+public void addListener(CacheListener listener)
+     Add a change listener
+Parameters:
+listener - the listener
+{code}
+
+h2. Error Handling
+CuratorCache instances internally monitor a {{ConnectionStateListener}}. If the connection state changes,
+the cache will receive messages detailing the change.
+
+h2. Additional Features
+
+CuratorCache has many additional features accessed when using {{CuratorCacheBuilder}}
+
+* {{forSingleNode()}} - cache a single ZNode instead of an entire tree
+* {{refreshingWhenStarted(boolean)}} - by default listeners get notified when the cache is refreshed. Use this method to change this.
+* {{sortingChildren(boolean)}} - by default, nodes are sorted by their node name. Use this method to change this.
+* {{withCacheSelector(selector)}} - set a filter that controls how the node tree is cached

http://git-wip-us.apache.org/repos/asf/curator/blob/9a05598c/curator-recipes/src/site/confluence/index.confluence
----------------------------------------------------------------------
diff --git a/curator-recipes/src/site/confluence/index.confluence b/curator-recipes/src/site/confluence/index.confluence
index 08ef762..6268097 100644
--- a/curator-recipes/src/site/confluence/index.confluence
+++ b/curator-recipes/src/site/confluence/index.confluence
@@ -23,10 +23,8 @@ regarding "Curator Recipes Own Their ZNode/Paths".
 |[[Shared Counter|shared-counter.html]] \- Manages a shared integer. All clients watching the same path will have the up\-to\-date value of the shared integer (considering ZK's normal consistency guarantees).|
 |[[Distributed Atomic Long|distributed-atomic-long.html]] \- A counter that attempts atomic increments. It first tries using optimistic locking. If that fails, an optional InterProcessMutex is taken. For both optimistic and mutex, a retry policy is used to retry the increment.|
 
-||Caches||
-|[[Path Cache|path-cache.html]] \- A Path Cache is used to watch a ZNode. Whenever a child is added, updated or removed, the Path Cache will change its state to contain the current set of children, the children's data and the children's state. Path caches in the Curator Framework are provided by the PathChildrenCache class. Changes to the path are passed to registered PathChildrenCacheListener instances.|
-|[[Node Cache|node-cache.html]] \- A utility that attempts to keep the data from a node locally cached. This class will watch the node, respond to update/create/delete events, pull down the data, etc. You can register a listener that will get notified when changes occur.|
-|[[Tree Cache|tree-cache.html]] \- A utility that attempts to keep all data from all children of a ZK path locally cached. This class will watch the ZK path, respond to update/create/delete events, pull down the data, etc. You can register a listener that will get notified when changes occur.|
+||Caching||
+|[[Curator Cache|curator-cache.html]] \- A Cache is used to watch a single ZNode, children of a ZNode or an entire tree of ZNodes. The cache will watch the node(s), respond to update/create/delete events, pull down the data, etc. You can register a listener that will get notified when changes occur.|
 
 ||Nodes||
 |[[Persistent Node|persistent-node.html]] \- A node that attempts to stay present in ZooKeeper, even through connection and session interruptions.|

http://git-wip-us.apache.org/repos/asf/curator/blob/9a05598c/curator-recipes/src/site/confluence/node-cache.confluence
----------------------------------------------------------------------
diff --git a/curator-recipes/src/site/confluence/node-cache.confluence b/curator-recipes/src/site/confluence/node-cache.confluence
deleted file mode 100644
index ca13b8e..0000000
--- a/curator-recipes/src/site/confluence/node-cache.confluence
+++ /dev/null
@@ -1,35 +0,0 @@
-h1. Node Cache
-
-h2. Description
-A Node Cache is used to watch a ZNode. Whenever the data is modified or the ZNode is deleted, the Node Cache will change its
-state to contain the current data (or null if ZNode was deleted).
-
-h2. Participating Classes
-* NodeCache
-* NodeCacheListener
-* ChildData
-
-h2. Usage
-h3. Creating a NodeChildrenCache
-{code}
-public NodeCache(CuratorFramework client,
-                         String path)
-Parameters:
-client - the client
-path - path to cache
-{code}
-
-h2. General Usage
-The cache must be started by calling {{start()}}. Call {{close()}} when you are through with the cache.
-
-At any time, call {{getCurrentData()}} to get the current state of the cache. You can also register to be notified
-when a change occurs by calling {{getListenable()}} and then:
-{code}
-public void addListener(NodeCacheListener listener)
-     Add a change listener
-Parameters:
-listener - the listener
-{code}
-
-h2. Error Handling
-NodeCache instances internally monitor a {{ConnectionStateListener}}.

http://git-wip-us.apache.org/repos/asf/curator/blob/9a05598c/curator-recipes/src/site/confluence/path-cache.confluence
----------------------------------------------------------------------
diff --git a/curator-recipes/src/site/confluence/path-cache.confluence b/curator-recipes/src/site/confluence/path-cache.confluence
deleted file mode 100644
index 1ced99d..0000000
--- a/curator-recipes/src/site/confluence/path-cache.confluence
+++ /dev/null
@@ -1,61 +0,0 @@
-h1. Path Cache
-
-h2. Description
-A Path Cache is used to watch a ZNode. Whenever a child is added, updated or removed, the Path Cache will change its state to contain the current set of children, the children's data and the children's state.
-
-h2. Participating Classes
-* PathChildrenCache
-* PathChildrenCacheEvent
-* PathChildrenCacheListener
-* ChildData
-
-h2. Usage
-h3. Creating a PathChildrenCache
-{code}
-public PathChildrenCache(CuratorFramework client,
-                         String path,
-                         boolean cacheData)
-Parameters:
-client - the client
-path - path to watch
-cacheData - if true, node contents are cached in addition to the stat
-{code}
-
-h2. General Usage
-The cache must be started by calling {{start()}}. Call {{close()}} when you are through with the cache.
-
-There are two versions of {{start()}}. The no\-arg version gives default behavior. The other version takes an enumeration that allows you to control how the initial cache is warmed:
-
-{code}
-public enum StartMode
-{
-    /**
-     * cache will _not_ be primed. i.e. it will start empty and you will receive
-     * events for all nodes added, etc.
-     */
-    NORMAL,
-
-    /**
-     * rebuild() will be called before this method returns in
-     * order to get an initial view of the node.
-     */
-    BUILD_INITIAL_CACHE,
-
-    /**
-     * After cache is primed with initial values (in the background) a
-     * PathChildrenCacheEvent.Type.INITIALIZED event will be posted
-     */
-    POST_INITIALIZED_EVENT
-}
-{code}
-
-At any time, call {{getCurrentData()}} to get the current state of the cache. You can also register to be notified when a change occurs by calling {{getListenable()}} and then:
-{code}
-public void addListener(PathChildrenCacheListener listener)
-     Add a change listener
-Parameters:
-listener - the listener
-{code}
-
-h2. Error Handling
-PathChildrenCache instances internally monitor a {{ConnectionStateListener}}. If the connection state changes, the cache is reset (the {{PathChildrenCacheListener}} will receive a RESET).

http://git-wip-us.apache.org/repos/asf/curator/blob/9a05598c/curator-recipes/src/site/confluence/tree-cache.confluence
----------------------------------------------------------------------
diff --git a/curator-recipes/src/site/confluence/tree-cache.confluence b/curator-recipes/src/site/confluence/tree-cache.confluence
deleted file mode 100644
index 0d67857..0000000
--- a/curator-recipes/src/site/confluence/tree-cache.confluence
+++ /dev/null
@@ -1,39 +0,0 @@
-h1. Tree Cache
-
-h2. Description
-A utility that attempts to keep all data from all children of a ZK path locally cached. This class will watch the ZK path, respond to update/create/delete events, pull down the data, etc. You can register a listener that will get notified when changes occur.
-
-h2. Participating Classes
-* TreeCache
-* TreeCacheListener
-* TreeCacheEvent
-* ChildData
-
-h2. Usage
-h3. Creating a TreeCache
-{code}
-public TreeCache(CuratorFramework client,
-                         String path,
-                         boolean cacheData)
-Parameters:
-client - the client
-path - path to watch
-cacheData - if true, node contents are cached in addition to the stat
-{code}
-
-h2. General Usage
-The cache must be started by calling {{start()}}. Call {{close()}} when you are through with the cache.
-
-At any time, call {{getCurrentChildren()}} to get the current state of the cache. Alternatively, call {{getCurrentData()}} to get
-the data for a given path that's being monitored.
-
-You can also register to be notified when a change occurs by calling {{getListenable()}} and then:
-{code}
-public void addListener(TreeCacheListener listener)
-     Add a change listener
-Parameters:
-listener - the listener
-{code}
-
-h2. Error Handling
-TreeCache instances internally monitor a {{ConnectionStateListener}}. If the connection state changes, the cache will receive messages detailing the change.