blob: 68c36921ef18606411c21339df52c308c98ce27a [file] [log] [blame]
[[Curator RPC Proxy|index.html]] / Reference
h1. API Reference
h2. CuratorService
||API||Arguments||Return Value||Description||
|newCuratorProjection|connectionName|CuratorProjection|Allocates a projection to a configured CuratorFramework instance in the RPC server. "connectionName" is the name of a [[configured|configuration.html]] connection.|
|closeCuratorProjection|CuratorProjection|void|Close a CuratorProjection. Also closes any recipes, etc. created for the projection.|
|pingCuratorProjection|CuratorProjection|void|Keeps the CuratorProjection from timing out. NOTE: your [[EventService|events.html]] event loop will do this for you.|
|createNode|CreateSpec|Created path name|Create a ZNode|
|deleteNode|DeleteSpec|void|Delete a ZNode|
|getData|GetDataSpec|bytes|Return a ZNode's data|
|setData|SetDataSpec|Stat|Set a ZNode's data|
|exists|ExistsSpec|Stat|Check if a ZNode exists|
|getChildren|GetChildrenSpec|List of nodes|Get the child nodes for a ZNode|
|sync|path and async context|void|Do a ZooKeeper sync|
|closeGenericProjection|id|void|Closes any projection. All projections have an "id" field. This is the value to pass.|
|acquireLock|path, maxWaitMs|optional lock projection|Acquire a lock for the given path. Will wait at most maxWaitMs to acquire the lock. If the acquisition fails, result will be null.|
|startLeaderSelector|path, participantId, waitForLeadershipMs|LeaderResult|Start a leader selector on the given path. The instance will be assigned the specified participantId. If waitForLeadershipMs is non\-zero, the method will block for that amount of time waiting for leadership.|
|getLeaderParticipants|leaderProjection|List of Participant|Return the participants in a leader selector|
|isLeader|leaderProjection|bool|Return true if the specified projection is the current leader|
|startPathChildrenCache|path, cacheData, dataIsCompressed, startMode|cache projection|Start a PathChildrenCache for the given path. Can optionally cache data, use compressed data.|
|getPathChildrenCacheData|cacheProjection|List of ChildData|Get all the data for a path cache|
|getPathChildrenCacheDataForPath|cacheProjection, path|ChildData|Get the data for a single ZNode in a path cache|
|startNodeCache|path, dataIsCompressed, buildInitial|node cache projection|Start a node cache for the given path. Can optionally use compressed data and build the initial cache.|
|getNodeCacheData|node cache projection|ChildData|Return the data for the cached node. If the node doesn't exist, the fields of the ChildData object will be null.|
|startPersistentEphemeralNode|path, data, mode|projection|Start a PersistentEphemeralNode for the given path using the given data and mode.|
|acquireSemaphore|path, acquireQty, maxWaitMs, maxLeases|List of lease projections|Acquire one or more leases for a semaphore on the given path. acquireQty is the number of leases to acquire. maxWaitMs is the max time to wait to get the leases. maxLeases is the maximum leases to allow for the semaphore. If the number of leases cannot be acquired within the max time, an empty list is returned.|
h2. EventService
||API||Arguments||Return Value||Description||
|getNextEvent|CuratorProjection|CuratorEvent|Returns the next queued event for the given CuratorProjection. If no events are queued within the [[configured|configuration.html]] ping time, a PING event is returned.|
See the [[Events Page|events.html]] for the CuratorEvent schema reference.
h2. DiscoveryService
||API||Arguments||Return Value||Description||
|makeDiscoveryInstance|name, payload, port|DiscoveryInstance|Return a completed DiscoveryInstance using the RPC server's address and the given name, payload and port.|
|startDiscovery|basePath, yourInstance|discovery projection|Start a Service Discovery instance on the given path. If yourInstance is not null it will be registered as the local service.|
|startProvider|discoveryProjection, serviceName, providerStrategy, downTimeoutMs, downErrorThreshold|provider projection|start a Service Discovery Provider to return instances for the given service name using the given provider strategy. Specify "down" instance characteristics with downTimeoutMs and downErrorThreshold.|
|getInstance|provider projection|DiscoveryInstance|Return a single instance for the given service|
|getAllInstances|provider projection|list of DiscoveryInstance|Return all instances for the given service|
|noteError|provider projection, service id|void|Note an error for the given service instance|
h1. Struct Reference
h2. CreateSpec
||Field||Type||Required||Description||
|path|string|*Y*|the ZNode path|
|data|bytes|\-|data for the node|
|mode|CreateMode|\-|PERSISTENT, PERSISTENT\_SEQUENTIAL, EPHEMERAL, or EPHEMERAL\_SEQUENTIAL|
|asyncContext|string|\-|if not null, createNode() is performed asynchronously and this is the context used in the async message|
|compressed|bool|\-|if true, compress the data|
|creatingParentsIfNeeded|bool|\-|if true, create any needed parent nodes|
|withProtection|bool|\-|if true, use Curator protection|
h2. DeleteSpec
||Field||Type||Required||Description||
|path|string|*Y*|the ZNode path|
|guaranteed|bool|\-|if true, use guaranteed deletion|
|asyncContext|string|\-|if not null, createNode() is performed asynchronously and this is the context used in the async message|
|compressed|bool|\-|if true, compress the data|
|version|Version|\-|if not null, uses Version.version when deleting the node. Otherwise, \-1 is used.|
h2. GetDataSpec
||Field||Type||Required||Description||
|path|string|*Y*|the ZNode path|
|watched|bool|\-|if true, trigger watch events for this node|
|asyncContext|string|\-|if not null, createNode() is performed asynchronously and this is the context used in the async message|
|decompressed|bool|\-|if true, decompress the data|
h2. SetDataSpec
||Field||Type||Required||Description||
|path|string|*Y*|the ZNode path|
|data|bytes|*Y*|data for the node|
|watched|bool|\-|if true, trigger watch events for this node|
|asyncContext|string|\-|if not null, createNode() is performed asynchronously and this is the context used in the async message|
|compressed|bool|\-|if true, compress the data|
|version|Version|\-|if not null, uses Version.version when setting the node data. Otherwise, \-1 is used.|
h2. ExistsSpec
||Field||Type||Required||Description||
|path|string|*Y*|the ZNode path|
|watched|bool|\-|if true, trigger watch events for this node|
|asyncContext|string|\-|if not null, createNode() is performed asynchronously and this is the context used in the async message|
h2. GetChildrenSpec
||Field||Type||Required||Description||
|path|string|*Y*|the ZNode path|
|watched|bool|\-|if true, trigger watch events for this node|
|asyncContext|string|\-|if not null, createNode() is performed asynchronously and this is the context used in the async message|
h2. LeaderResult
||Field||Type||Description||
|projection|LeaderProjection|the projection of the leader|
|isLeader|bool|true if this projection is the leader|
h2. Participant
||Field||Type||Description||
|id|string|participant id|
|isLeader|bool|true if this participant is the leader|
h2. ChildData
||Field||Type||Description||
|path|string|the ZNode path|
|stat|Stat|ZooKeeper stat for the node|
|data|bytes|node data or null|