Members
changeEventName
Constant for event name to avoid strings everywhere
RecipesClient
The client object for recipes
Methods
generateClientId() → {string}
Generates a unique client id;
Returns:
- The unique client id
- Type
- string
getClientNodePrefix(clientId, prefixopt) → {string}
Generates the client node prefix for the given client id and (optional) prefix
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
clientId |
string | The client id |
|
prefix |
string |
<optional> |
The optional prefix |
Returns:
- Type
- string
leaderSelector(clientNodePrefix) → {function}
Returns a function that returns true iff the first of the supplied nodes matches the prefix, i.e. if the client with that prefix is in the "leader" position.
Parameters:
Name | Type | Description |
---|---|---|
clientNodePrefix |
string | The client node prefix |
Returns:
- Type
- function
makeRetryable(obs$, delay$, retryPredicateopt) → {Observable}
Makes an observable retryable with the provided delays.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
obs$ |
Observable | The input observable |
|
delay$ |
Observable | The delays to use |
|
retryPredicate |
function |
<optional> |
Determines if the retry should occur based on the supplied error object. If not supplied, all errors are retried. |
Returns:
- Type
- Observable
observeClientState(clientFactory) → {Observable}
Creates an observable of client state using the given client factory. when subscribed to, this creates a new client and connects to it. The observable elements are { client, connected, readonly } and reflect the current state of the client. Throws an error in the event of a nonrecoverable state.
Parameters:
Name | Type | Description |
---|---|---|
clientFactory |
function | Function that returns a node-zookeeper-client instance |
Returns:
- Type
- Observable
observeCreateNode(options)
Creates an observable that emits true when a node has been removed
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
observeDelay(options) → {Observable}
Creates an observable of delay values for retries given the provided retry options
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
Returns:
- Type
- Observable
observeExclusiveLock(options)
Generates an observable for an exclusive lock on a resource.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
observeLeaderState(options)
Attempts to acquire a lock and the given path and observes the lock state
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | The options Properties
|
observeNodeChildren(client, options)
Creates an observable of the children of a node. The filter and sort functions are passed the node names of the children, without the parent path.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
client |
ZookeeperClient | The node-zookeeper-client instance |
||||||||||||||||||||
options |
Object |
Properties
|
observeNodeValue(options)
Creates an observable of a node
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
observeOneForAllAction(options)
Generates an observable for an all for one action
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
observeRemoveNode(client, options)
Creates an observable that emits true when a node has been removed
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
client |
ZookeeperClient | The node-zookeeper-client instance |
|||||||||||||||
options |
Object |
Properties
|
observeSeekClientNodeState(options)
Generates an observable for an exclusive lock on a resource.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
observeSeekState(options)
A generic state seeking algorithm that takes the supplied observable and returns its state, optionally transformed, as the output. This repeats indefinitely after the wait observable completes on each cycle, so that observable should emit when the state should be reevaluated and issued by the main observable.
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
parseClientNode(node, sequential) → {Object}
Parses a client node name, i.e. the node name without the full path. Returns an object with a client property and, if appropriate, type and sequence properties.
Parameters:
Name | Type | Description |
---|---|---|
node |
string | The node name to parseClientNode |
sequential |
boolean | Whether this node has a sequence number appended |
Returns:
- Type
- Object
sortClientNodesBySequence() → {number}
Sorting function for nodes, sorts in ascending order of sequence number. Only applicable to sequential nodes.
Returns:
- Type
- number