5.3.8. vlcp.protocol.zookeeper

Note

This document is generated from the source file.

View Source on GitHub

Created on 2016/9/13

author:think
class vlcp.protocol.zookeeper.ZooKeeper

ZooKeeper protocol

__init__()

Constructor

async_requests(connection, requests, container=None, priority=0)
Returns:(matchers, sendall), where matchers are event matchers for the requests; sendall is an async function to send to requests. Use await sendall() to send the requests.
closed(connection)

routine for connection closed

error(connection)

routine for connection error

init(connection)

routine for connection initialization

keepalive(connection)

routine executed when there has been a long time since last data arrival. Check if the connection is down.

notconnected(connection)

routine for connect failed and not retrying

parse(connection, data, laststart)

Parse input data into events

Parameters:
  • connection – connection object
  • data – view for input data
  • laststart – last parsed position
Returns:

(events, keep) where events are parsed events to send, keep is the unused data length to be keeped for next parse.

reconnect_init(connection)

routine for reconnect

requests(connection, requests, container=None, callback=None, priority=0)

Send requests by sequence, return all the results (including the lost ones)

Params connection:
 ZooKeeper connection
Params requests:
 a sequence of ZooKeeper requests
Params container:
 routine container of current routine
Params callback:
 if not None, callback(request, response) is called immediately after each response received
Returns:(responses, lost_responses, retry_requests), where responses is a list of responses corresponded to the requests (None if response is not received); lost_responses is a list of requests that are sent but the responses are lost due to connection lost, it is the caller’s responsibility to determine whether the call is succeeded or failed; retry_requests are the requests which are not sent and are safe to retry.
serialize(connection, event)

Serialize a write event to bytes, and return if it is EOF

Parameters:
  • connection – connection object
  • event – write event
Returns:

(bytes, EOF)

class vlcp.protocol.zookeeper.ZooKeeperConnectionStateEvent(*args, **kwargs)
exception vlcp.protocol.zookeeper.ZooKeeperException
class vlcp.protocol.zookeeper.ZooKeeperHandshakeEvent(*args, **kwargs)
class vlcp.protocol.zookeeper.ZooKeeperMessageEvent(*args, **kwargs)
exception vlcp.protocol.zookeeper.ZooKeeperProtocolException
exception vlcp.protocol.zookeeper.ZooKeeperRequestTooLargeException

Request is too large, which may break every thing, so we reject it

class vlcp.protocol.zookeeper.ZooKeeperResponseEvent(*args, **kwargs)
exception vlcp.protocol.zookeeper.ZooKeeperRetryException

Connection lost or not connected on handshake

exception vlcp.protocol.zookeeper.ZooKeeperSessionExpiredException

Handshake reports the session is expired

class vlcp.protocol.zookeeper.ZooKeeperWatcherEvent(*args, **kwargs)
class vlcp.protocol.zookeeper.ZooKeeperWriteEvent(*args, **kwargs)