kazoo.protocol.states¶
Kazoo State and Event objects
Public API¶
- class kazoo.protocol.states.EventType[source]¶
Zookeeper Event
Represents a Zookeeper event. Events trigger watch functions which will receive a EventType attribute as their event argument.
- CREATED¶
A node has been created.
- DELETED¶
A node has been deleted.
- CHANGED¶
The data for a node has changed.
- CHILD¶
The children under a node have changed (a child was added or removed). This event does not indicate the data for a child node has changed, which must have its own watch established.
- class kazoo.protocol.states.KazooState[source]¶
High level connection state values
States inspired by Netflix Curator.
- SUSPENDED¶
The connection has been lost but may be recovered. We should operate in a “safe mode” until then. When the connection is resumed, it may be discovered that the session expired. A client should not assume that locks are valid during this time.
- CONNECTED¶
The connection is alive and well.
- LOST¶
The connection has been confirmed dead. Any ephemeral nodes will need to be recreated upon re-establishing a connection. If locks were acquired or recipes using ephemeral nodes are in use, they can be considered lost as well.
- class kazoo.protocol.states.KeeperState[source]¶
Zookeeper State
Represents the Zookeeper state. Watch functions will receive a KeeperState attribute as their state argument.
- AUTH_FAILED¶
Authentication has failed, this is an unrecoverable error.
- CONNECTED¶
Zookeeper is connected.
- CONNECTED_RO¶
Zookeeper is connected in read-only state.
- CONNECTING¶
Zookeeper is currently attempting to establish a connection.
- EXPIRED_SESSION¶
The prior session was invalid, all prior ephemeral nodes are gone.
- class kazoo.protocol.states.WatchedEvent[source]¶
A change on ZooKeeper that a Watcher is able to respond to.
The WatchedEvent includes exactly what happened, the current state of ZooKeeper, and the path of the node that was involved in the event. An instance of WatchedEvent will be passed to registered watch functions.
- state¶
A KeeperState attribute indicating the Zookeeper state.
- path¶
The path of the node for the watch event.
- class kazoo.protocol.states.ZnodeStat[source]¶
A ZnodeStat structure with convenience properties
When getting the value of a node from Zookeeper, the properties for the node known as a “Stat structure” will be retrieved. The ZnodeStat object provides access to the standard Stat properties and additional properties that are more readable and use Python time semantics (seconds since epoch instead of ms).
Note
The original Zookeeper Stat name is in parens next to the name when it differs from the convenience attribute. These are not functions, just attributes.
- creation_transaction_id(czxid)[source]¶
The transaction id of the change that caused this znode to be created.
- last_modified_transaction_id(mzxid)[source]¶
The transaction id of the change that last modified this znode.
- created(ctime)[source]¶
The time in seconds from epoch when this node was created. (ctime is in milliseconds)
- last_modified(mtime)[source]¶
The time in seconds from epoch when this znode was last modified. (mtime is in milliseconds)
- version¶
The number of changes to the data of this znode.