t.p.a.Descriptor(Integer) : class documentation

Part of twisted.protocols.amp View Source View In Hierarchy

Encode and decode file descriptors for exchange over a UNIX domain socket.

This argument type requires an AMP connection set up over an IUNIXTransport provider (for example, the kind of connection created by IReactorUNIX.connectUNIX and UNIXClientEndpoint).

There is no correspondence between the integer value of the file descriptor on the sending and receiving sides, therefore an alternate approach is taken to matching up received descriptors with particular Descriptor parameters. The argument is encoded to an ordinal (unique per connection) for inclusion in the AMP command or response box. The descriptor itself is sent using IUNIXTransport.sendFileDescriptor. The receiver uses the order in which file descriptors are received and the ordinal value to come up with the received copy of the descriptor.

Method fromStringProto Take a unique identifier associated with a file descriptor which must have been received by now and use it to look up that descriptor in a dictionary where they are kept.
Method toStringProto Send inObject, an integer file descriptor, over proto's connection and return a unique identifier which will allow the receiver to associate the file descriptor with this argument.

Inherited from Integer:

Method toString Convert a Python object into a string for passing over the network.

Inherited from Argument (via Integer):

Method __init__ Create an Argument.
Method retrieve Retrieve the given key from the given dictionary, removing it if found.
Method fromBox Populate an 'out' dictionary with mapping names to Python values decoded from an 'in' AmpBox mapping strings to string values.
Method toBox Populate an 'out' AmpBox with strings encoded from an 'in' dictionary mapping names to Python values.
Method fromString Convert a string to a Python object. Subclasses must implement this.
def fromStringProto(self, inString, proto): (source)
Take a unique identifier associated with a file descriptor which must have been received by now and use it to look up that descriptor in a dictionary where they are kept.
ParametersinStringThe base representation (as a byte string) of an ordinal indicating which file descriptor corresponds to this usage of this argument. (type: str)
protoThe protocol used to receive this descriptor. This protocol must be connected via a transport providing IUNIXTransport. (type: BinaryBoxProtocol)
ReturnsThe file descriptor represented by inString. (type: int)
def toStringProto(self, inObject, proto): (source)
Send inObject, an integer file descriptor, over proto's connection and return a unique identifier which will allow the receiver to associate the file descriptor with this argument.
ParametersinObjectA file descriptor to duplicate over an AMP connection as the value for this argument. (type: int)
protoThe protocol which will be used to send this descriptor. This protocol must be connected via a transport providing IUNIXTransport.
ReturnsA byte string which can be used by the receiver to reconstruct the file descriptor.
API Documentation for Twisted, generated by pydoctor at 2013-11-08 22:07:30.