class documentation

class Broker(banana.Banana): (source)

Known subclasses: twisted.mail.pb.MaildirBroker, twisted.mail.pb.MaildirClient

View In Hierarchy

I am a broker for objects.
Method __init__ Undocumented
Method cached​Locally​As Undocumented
Method cached​Remotely​As No summary
Method cache​Locally (internal)
Method cache​Remotely XXX
Method connection​Failed Undocumented
Method connection​Lost The connection was lost.
Method connection​Ready Initialize. Called after Banana negotiation is done.
Method dec​Cache​Ref (internal) Send a DECACHE directive.
Method dont​Notify​On​Disconnect
Method expression​Received Evaluate an expression as it's received.
Method local​Object​For​ID Get a local object for a locally unique ID.
Method new​Local​ID
Method new​Request​ID
Method notify​On​Connect
Method notify​On​Disconnect
Method notify​On​Fail
Method pause​Producing Undocumented
Method proto​_answer (internal) Got an answer to a previously sent message.
Method proto​_cachemessage Undocumented
Method proto​_decache (internal) Decrement the reference count of a cached object.
Method proto​_decref (internal) Decrement the reference count of an object.
Method proto_did​Not​Understand Respond to stock 'didNotUnderstand' message.
Method proto​_error (internal) Deal with an error.
Method proto​_message Undocumented
Method proto​_uncache (internal) Tell the client it is now OK to uncache an object.
Method proto​_version Protocol message: (version version-number)
Method register​Page​Producer Undocumented
Method register​Reference Store a persistent reference to a local object and map its id() to a generated, session-unique ID.
Method remote​For​Name Returns an object from the remote name mapping.
Method remotely​Cached​For​LUID
Method resume​Producing Called when the consumer attached to me runs out of buffer.
Method send​Call Utility method to send an expression to the other side of the connection.
Method send​Dec​Ref (internal) Send a DECREF directive.
Method serialize Jelly an object according to the remote security rules for this broker.
Method set​Name​For​Local Store a special (string) ID for this object.
Method stop​Producing Undocumented
Method unserialize Unjelly an sexp according to the local security rules for this broker.
Class Variable factory Undocumented
Class Variable username Undocumented
Class Variable version Undocumented
Instance Variable connects Undocumented
Instance Variable current​Local​ID Undocumented
Instance Variable current​Request​ID Undocumented
Instance Variable disconnected Undocumented
Instance Variable disconnects Undocumented
Instance Variable failures Undocumented
Instance Variable jelly​Args Undocumented
Instance Variable jelly​Kw Undocumented
Instance Variable jelly​Method Undocumented
Instance Variable locally​Cached​Objects Undocumented
Instance Variable local​Objects Undocumented
Instance Variable local​Security Undocumented
Instance Variable luids Undocumented
Instance Variable max​Broker​Refs​Violations Undocumented
Instance Variable page​Producers Undocumented
Instance Variable remotely​Cached​LUIDs Undocumented
Instance Variable remotely​Cached​Objects Undocumented
Instance Variable remote​Security Undocumented
Instance Variable security Undocumented
Instance Variable serializing​Perspective Undocumented
Instance Variable unserializing​Perspective Undocumented
Instance Variable waiting​For​Answers Undocumented
Method _recv​Message Received a message-send.
Method _send​Answer (internal) Send an answer to a previously sent message.
Method _send​Error (internal) Send an error for a previously sent message.
Method _send​Failure Log error and then send it.
Method _send​Failure​Or​Error Call _sendError or _sendFailure, depending on whether fail represents an Error subclass or not.
Method _send​Message Undocumented
Instance Variable _local​Cleanup Undocumented

Inherited from Banana:

Method call​Expression​Received Undocumented
Method connection​Made Called when a connection is made.
Method data​Received Called whenever data is received.
Method got​Item Undocumented
Method send​Encoded Send the encoded representation of the given object:
Method set​Prefix​Limit Set the prefix limit for decoding done by this protocol instance.
Class Variable incoming​Vocabulary Undocumented
Class Variable outgoing​Vocabulary Undocumented
Instance Variable buffer Undocumented
Instance Variable current​Dialect Undocumented
Instance Variable is​Client Undocumented
Instance Variable known​Dialects These are the profiles supported by this Banana implementation.
Instance Variable list​Stack Undocumented
Instance Variable outgoing​Symbol​Count Undocumented
Instance Variable outgoing​Symbols Undocumented
Instance Variable prefix​Limit Undocumented
Method _encode Undocumented
Method _select​Dialect Undocumented
Instance Variable _largest​Int Undocumented
Instance Variable _largest​Long​Int Undocumented
Instance Variable _smallest​Int Undocumented
Instance Variable _smallest​Long​Int Undocumented

Inherited from Protocol (via Banana):

Method log​Prefix Return a prefix matching the class name, to identify log messages related to this protocol instance.

Inherited from BaseProtocol (via Banana, Protocol):

Method make​Connection Make a connection to a transport and a server.
Instance Variable connected Undocumented
Instance Variable transport Undocumented

Inherited from Ephemeral (via Banana):

Method __getstate__ Undocumented
Method __reduce__ Serialize any subclass of Ephemeral in a way which replaces it with Ephemeral itself.
Method __setstate__ Undocumented
Instance Variable __class__ Undocumented
def __init__(self, isClient=1, security=globalSecurity): (source)

Undocumented

def cachedLocallyAs(self, cid): (source)

Undocumented

def cachedRemotelyAs(self, instance, incref=0): (source)
Parameters
instanceThe instance to look up.
increfFlag to specify whether to increment the reference.
Returns
An ID that says what this instance is cached as remotely, or None if it's not.
def cacheLocally(self, cid, instance): (source)

(internal)

Store a non-filled-out cached instance locally.

def cacheRemotely(self, instance): (source)
XXX
Returns
A new LUID.
def connectionFailed(self): (source)

Undocumented

def connectionLost(self, reason): (source)
The connection was lost.
Parameters
reasonmessage to put in failure.Failure
def connectionReady(self): (source)
Initialize. Called after Banana negotiation is done.
def decCacheRef(self, objectID): (source)
(internal) Send a DECACHE directive.
Parameters
object​IDThe object ID.
def dontNotifyOnDisconnect(self, notifier): (source)
Parameters
notifiercallback to remove from list of disconnect callbacks.
def expressionReceived(self, sexp): (source)
Evaluate an expression as it's received.
def localObjectForID(self, luid): (source)
Get a local object for a locally unique ID.
Returns
An object previously stored with registerReference or None if there is no object which corresponds to the given identifier.
def newLocalID(self): (source)
Returns
A newly generated LUID.
def newRequestID(self): (source)
Returns
A newly generated request ID.
def notifyOnConnect(self, notifier): (source)
Parameters
notifiercallback to call when the Broker connects.
def notifyOnDisconnect(self, notifier): (source)
Parameters
notifiercallback to call when the Broker disconnects.
def notifyOnFail(self, notifier): (source)
Parameters
notifiercallback to call if the Broker fails to connect.
def pauseProducing(self): (source)

Undocumented

def proto_answer(self, requestID, netResult): (source)

(internal) Got an answer to a previously sent message.

Look up the appropriate callback and call it.

Parameters
request​IDThe request ID.
net​ResultThe answer.
def proto_cachemessage(self, requestID, objectID, message, answerRequired, netArgs, netKw): (source)

Undocumented

def proto_decache(self, objectID): (source)

(internal) Decrement the reference count of a cached object.

If the reference count is zero, free the reference, then send an 'uncached' directive.

Parameters
object​IDThe object ID.
def proto_decref(self, objectID): (source)

(internal) Decrement the reference count of an object.

If the reference count is zero, it will free the reference to this object.

Parameters
object​IDThe object ID.
def proto_didNotUnderstand(self, command): (source)

Respond to stock 'didNotUnderstand' message.

Log the command that was not understood and continue. (Note: this will probably be changed to close the connection or raise an exception in the future.)

Parameters
commandThe command to log.
def proto_error(self, requestID, fail): (source)
(internal) Deal with an error.
Parameters
request​IDThe request ID.
failThe failure.
def proto_message(self, requestID, objectID, message, answerRequired, netArgs, netKw): (source)

Undocumented

def proto_uncache(self, objectID): (source)
(internal) Tell the client it is now OK to uncache an object.
Parameters
object​IDThe object ID.
def proto_version(self, vnum): (source)

Protocol message: (version version-number)

Check to make sure that both ends of the protocol are speaking the same version dialect.

Parameters
vnumThe version number.
def registerPageProducer(self, pager): (source)

Undocumented

def registerReference(self, object): (source)
Store a persistent reference to a local object and map its id() to a generated, session-unique ID.
Parameters
objecta local object
Returns
the generated ID
def remoteForName(self, name): (source)

Returns an object from the remote name mapping.

Note that this does not check the validity of the name, only creates a translucent reference for it.

Parameters
nameThe name to look up.
Returns
An object which maps to the name.
def remotelyCachedForLUID(self, luid): (source)
Parameters
luidThe LUID to look up.
Returns
An instance which is cached remotely.
def resumeProducing(self): (source)
Called when the consumer attached to me runs out of buffer.
def sendCall(self, *exp): (source)
Utility method to send an expression to the other side of the connection.
Parameters
*expThe expression.
def sendDecRef(self, objectID): (source)
(internal) Send a DECREF directive.
Parameters
object​IDThe object ID.
def serialize(self, object, perspective=None, method=None, args=None, kw=None): (source)
Jelly an object according to the remote security rules for this broker.
Parameters
objectThe object to jelly.
perspectiveThe perspective.
methodThe method.
argsArguments.
kwKeyword arguments.
def setNameForLocal(self, name, object): (source)

Store a special (string) ID for this object.

This is how you specify a 'base' set of objects that the remote protocol can connect to.

Parameters
nameAn ID.
objectThe object.
def stopProducing(self): (source)

Undocumented

def unserialize(self, sexp, perspective=None): (source)
Unjelly an sexp according to the local security rules for this broker.
Parameters
sexpThe object to unjelly.
perspectiveThe perspective.
username = (source)

Undocumented

version: int = (source)

Undocumented

connects = (source)

Undocumented

currentLocalID = (source)

Undocumented

currentRequestID = (source)

Undocumented

disconnected: int = (source)

Undocumented

disconnects = (source)

Undocumented

failures = (source)

Undocumented

jellyArgs = (source)

Undocumented

jellyKw = (source)

Undocumented

jellyMethod = (source)

Undocumented

locallyCachedObjects = (source)

Undocumented

localObjects = (source)

Undocumented

localSecurity = (source)

Undocumented

luids = (source)

Undocumented

maxBrokerRefsViolations = (source)

Undocumented

pageProducers: list = (source)

Undocumented

remotelyCachedLUIDs = (source)

Undocumented

remotelyCachedObjects = (source)

Undocumented

remoteSecurity = (source)

Undocumented

security = (source)

Undocumented

serializingPerspective = (source)

Undocumented

unserializingPerspective = (source)

Undocumented

waitingForAnswers = (source)

Undocumented

def _recvMessage(self, findObjMethod, requestID, objectID, message, answerRequired, netArgs, netKw): (source)

Received a message-send.

Look up message based on object, unserialize the arguments, and invoke it with args, and send an 'answer' or 'error' response.

Parameters
find​Obj​MethodA callable which takes objectID as argument.
request​IDThe requiest ID.
object​IDThe object ID.
messageThe message.
answer​Required
net​ArgsArguments.
net​KwKeyword arguments.
def _sendAnswer(self, netResult, requestID): (source)
(internal) Send an answer to a previously sent message.
Parameters
net​ResultThe answer.
request​IDThe request ID.
def _sendError(self, fail, requestID): (source)
(internal) Send an error for a previously sent message.
Parameters
failThe failure.
request​IDThe request ID.
def _sendFailure(self, fail, requestID): (source)
Log error and then send it.
Parameters
failThe failure.
request​IDThe request ID.
def _sendFailureOrError(self, fail, requestID): (source)
Call _sendError or _sendFailure, depending on whether fail represents an Error subclass or not.
Parameters
failThe failure.
request​IDThe request ID.
def _sendMessage(self, prefix, perspective, objectID, message, args, kw): (source)

Undocumented

_localCleanup: dict = (source)

Undocumented