l.c.p.s.PullerWireProtocol(NetstringReceiver) : class documentation

Part of lp.codehosting.puller.scheduler View In Hierarchy

The wire protocol for receiving events from the puller worker.

The wire-level protocol is a series of netstrings.

At the next level up, the protocol consists of messages which each look
like this::

        [method-name] [number-of-arguments] [arguments]+

Thus the instance is always in one of three states::

    [0] Waiting for command name.
    [1] Waiting for argument count.
    [2] Waiting for an argument.

In state [0], we are waiting for a command name.  When we get one, we
store it in self._current_command and move into state [1].

In state [1], we are waiting for an argument count.  When we receive a
message, we try to convert it to an integer.  If we fail in this, we call
unexpectedError().  Otherwise, if it's greater than zero, we store the
number in self._expected_args and go into state [2] or if it's zero
execute the command (see below).

In state [2], we are waiting for an argument.  When we receive one, we
append it to self._current_args.  If len(self._current_args) ==
self._expected_args, execute the command.

"Executing the command" means looking for a method called
do_<command name> on self.puller_protocol and calling it with
*self._current_args.  If this raises, call

The method _resetState() forces us back into state [0].
Method __init__ Undocumented
Method dataReceived See NetstringReceiver.dataReceived.
Method stringReceived See NetstringReceiver.stringReceived.
Method _resetState Force into the 'waiting for command' state.
def __init__(self, puller_protocol):
def dataReceived(self, data):
See NetstringReceiver.dataReceived.
def stringReceived(self, line):
See NetstringReceiver.stringReceived.
def _resetState(self):
Force into the 'waiting for command' state.
API Documentation for Launchpad, generated by pydoctor at 2020-02-26 00:00:44.