kazoo.handlers.eventlet

A eventlet based handler.

Public API

class kazoo.handlers.eventlet.SequentialEventletHandler[source]

Eventlet handler for sequentially executing callbacks.

This handler executes callbacks in a sequential manner. A queue is created for each of the callback events, so that each type of event has its callback type run sequentially. These are split into two queues, one for watch events and one for async result completion callbacks.

Each queue type has a greenthread worker that pulls the callback event off the queue and runs it in the order the client sees it.

This split helps ensure that watch callbacks won’t block session re-establishment should the connection be lost during a Zookeeper client call.

Watch and completion callbacks should avoid blocking behavior as the next callback of that type won’t be run until it completes. If you need to block, spawn a new greenthread and return immediately so callbacks can proceed.

Note

Completion callbacks can block to wait on Zookeeper calls, but no other completion callbacks will execute until the callback returns.

Private API

class kazoo.handlers.eventlet.AsyncResult(handler)[source]

A one-time event that stores a value or an exception