Module: ZooKeeper::RubyIO

Defined in:
lib/zkruby/rubyio.rb

Overview

Binding over standard ruby sockets

Manages 3 threads per zookeeper session

Read thread

manages connecting to and reading from the tcp socket. Uses non blocking io to manage timeouts
and initiate the required ping requests.

Write thread

each new connection spawns a new thread. Requests coming from the session in response
to multiple threads are written to a blocking queue. While the connection is alive
this thread reads from the queue and writes to the socket, all in blocking fashion
TODO: Is it really ok to do a non-blocking read during a blocking write?

Event thread

All response and watch callbacks are put on another blocking queue to be read and executed
by this thread.

All interaction with the session is synchronized

Client synchronous code is implemented with a condition variable that waits on the callback/errback

Defined Under Namespace

Classes: AsyncOp, Binding, Connection