Kazoo State and Event objects
- class kazoo.protocol.states.EventType¶
Represents a Zookeeper event. Events trigger watch functions which will receive a EventType attribute as their event argument.
A node has been created.
A node has been deleted.
The data for a node has changed.
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.
The connection state has been altered.
- class kazoo.protocol.states.KazooState¶
High level connection state values
States inspired by Netflix Curator.
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.
The connection is alive and well.
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¶
Represents the Zookeeper state. Watch functions will receive a KeeperState attribute as their state argument.
Authentication has failed, this is an unrecoverable error.
Zookeeper is connected.
Zookeeper is connected in read-only state.
Zookeeper is currently attempting to establish a connection.
The prior session was invalid, all prior ephemeral nodes are gone.
- class kazoo.protocol.states.WatchedEvent¶
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.
The path of the node for the watch event.
- class kazoo.protocol.states.ZnodeStat¶
A ZnodeStat structure with convenience properties
When getting the value of a znode from Zookeeper, the properties for the znode 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).
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.
The transaction id of the change that caused this znode to be created.
The transaction id of the change that last modified this znode.
The time in seconds from epoch when this znode was created. (ctime is in milliseconds)
The time in seconds from epoch when this znode was last modified. (mtime is in milliseconds)
The number of changes to the data of this znode.
The number of changes to the ACL of this znode.
The session id of the owner of this znode if the znode is an ephemeral node. If it is not an ephemeral node, it will be None. (ephemeralOwner will be 0 if it is not ephemeral)
The length of the data field of this znode.
The number of children of this znode.