Part of twisted.protocols.amp View Source View In Hierarchy
Known subclasses: twisted.protocols.amp.AMP
| Method | __init__ | Create an _AmpParserBase, initializing request-response tracking state. |
| Method | _puke | This is a terminal callback called after application code has had a |
| Method | _nextTag | Generate protocol-local serial numbers for _ask keys. |
| Method | failAllOutgoing | Call the errback on all outstanding requests awaiting responses. |
| Method | ampBoxReceived | An AmpBox was received. Respond to it according to its contents. |
| Method | _sendBoxCommand | Send a command across the wire with the given
amp.Box.
|
| Method | callRemoteString | This is a low-level API, designed only for opitmizing simple messages |
| Method | callRemote | This is the primary high-level API for sending messages via AMP. Invoke it |
Inherited from _DispatchMixin:
| Method | _wrapWithSerialization | Wrap aCallable with its command's argument de-serialization |
| Method | lookupFunction | Return a callable to invoke when executing the named command. |
| Method | dispatchCommand | A box with a _command key was received. |
| Returns | a string that has not yet been used on this connection. | |
| Parameters | reason | the Failure instance to pass to those errbacks. |
| Parameters | box | an AmpBox |
Send a command across the wire with the given
amp.Box.
Mutate the given box to give it any additional keys (_command, _ask) required for the command and request/response machinery, then send it.
Returns a Deferred which fires with the response amp.Box
when it is received, or fails with a amp.RemoteAmpError if
an error is received.
| Parameters | command | a str, the name of the command to issue. |
| box | an AmpBox with the arguments for the command. | |
| requiresAnswer | a boolean. Defaults to True. If True, return a Deferred which will fire when the other side responds to this command. If False, return None and do not ask the other side for acknowledgement. | |
| Returns | a Deferred which fires the AmpBox that holds the response to this command, or None, as specified by requiresAnswer. | |
| Parameters | command | a str naming the command. |
| kw | arguments to the amp box. | |
| requiresAnswer | a boolean. Defaults to True. If True, return a Deferred which will fire when the other side responds to this command. If False, return None and do not ask the other side for acknowledgement. | |
| Returns | a Deferred which fires the AmpBox that holds the response to this command, or None, as specified by requiresAnswer. | |
| Parameters | commandType | a subclass of Command.
(type: type
) |
| a | Positional (special) parameters taken by the command. Positional
parameters will typically not be sent over the wire. The only command
included with AMP which uses positional parameters is ProtocolSwitchCommand,
which takes the protocol that will be switched to as its first
argument.
| |
| kw | Keyword arguments taken by the command. These are the arguments
declared in the command's 'arguments' attribute. They will be encoded and
sent to the peer as arguments for the commandType.
| |
| Returns | If commandType has a requiresAnswer
attribute set to False, then return None.
Otherwise, return a Deferred
which fires with a dictionary of objects representing the result of this
call. Additionally, this Deferred may
fail with an exception representing a connection failure, with UnknownRemoteError
if the other end of the connection fails for an unknown reason, or with
any error specified as a key in commandType's
errors dictionary.
| |