Package twisted :: Package spread :: Module pb :: Class Broker |
[show private | hide private]
[frames | no frames]

## Class Broker

    BaseProtocol --+
                   |
            Protocol --+
                       |
           Ephemeral --+
                       |
                  Pynana --+
                           |
                      Canana --+
                               |
                              Broker

Known Subclasses:
  `MaildirBroker`, `MaildirClient`

I am a broker for objects.

Method Summary
| `__init__(self, isClient, security)`
| `__getstate__(self)` (inherited from `Ephemeral`)
| `__setstate__(self, state)` (inherited from `Ephemeral`)
| `cachedLocallyAs(self, cid)`
| ``cachedRemotelyAs`(self, instance, incref)` Returns an ID that says what this instance is cached as remotely, or `None`if it's not.
| ``cacheLocally`(self, cid, instance)` (internal)
| ``cacheRemotely`(self, instance)` XXX
| `callExpressionReceived(self, obj)` (inherited from `Pynana`)
| ``connectionFailed`(self)` (Deprecated)
| ``connectionLost`(self, reason)` The connection was lost.
| ``connectionMade`(self)` Called when a connection is made. (inherited from `Canana`)
| ``connectionReady`(self)` Initialize.
| `dataReceived(self, chunk)` (inherited from `Canana`)
| ``decCacheRef`(self, objectID)` (internal) Send a DECACHE directive.
| ``dontNotifyOnDisconnect`(self, notifier)` Remove a callback from list of disconnect callbacks.
| ``expressionReceived`(self, sexp)` Evaluate an expression as it's received.
| `gotItem(self, item)` (inherited from `Pynana`)
| ``localObjectForID`(self, luid)` Get a local object for a locally unique ID.
| ``makeConnection`(self, transport)` Make a connection to a transport and a server. (inherited from `BaseProtocol`)
| ``newLocalID`(self)` Generate a new LUID.
| ``newRequestID`(self)` Generate a new request ID.
| ``notifyOnConnect`(self, notifier)` Call the given callback when the Broker connects.
| ``notifyOnDisconnect`(self, notifier)` Call the given callback when the Broker disconnects.
| ``notifyOnFail`(self, notifier)` Call the given callback if the Broker fails to connect.
| `pauseProducing(self)`
| ``proto_answer`(self, requestID, netResult)` (internal) Got an answer to a previously sent message.
| `proto_cachemessage(self, requestID, objectID, message, answerRequired, netArgs, netKw)`
| ``proto_decache`(self, objectID)` (internal) Decrement the reference count of a cached object.
| ``proto_decref`(self, objectID)` (internal) Decrement the reference count of an object.
| ``proto_didNotUnderstand`(self, command)` Respond to stock '`didNotUnderstand`' message.
| ``proto_error`(self, requestID, fail)` (internal) Deal with an error.
| `proto_message(self, requestID, objectID, message, answerRequired, netArgs, netKw)`
| ``proto_uncache`(self, objectID)` (internal) Tell the client it is now OK to uncache an object.
| ``proto_version`(self, vnum)` Protocol message: (version version-number)
| `registerPageProducer(self, pager)`
| ``registerReference`(self, object)` Get an ID for a local object.
| ``remoteForName`(self, name)` Returns an object from the remote name mapping.
| ``remotelyCachedForLUID`(self, luid)` Returns an instance which is cached remotely, with this LUID.
| ``resumeProducing`(self)` Called when the consumer attached to me runs out of buffer.
| ``sendCall`(self, *exp)` Utility method to send an expression to the other side of the connection.
| ``sendDecRef`(self, objectID)` (internal) Send a DECREF directive.
| `sendEncoded(self, obj)` (inherited from `Canana`)
| ``serialize`(self, object, perspective, method, args, kw)` Jelly an object according to the remote security rules for this broker.
| ``setNameForLocal`(self, name, object)` Store a special (string) ID for this object.
| `stopProducing(self)`
| ``unserialize`(self, sexp, perspective)` Unjelly an sexp according to the local security rules for this broker.
| `_encode(self, obj, write)` (inherited from `Pynana`)
| ``_recvMessage`(self, findObjMethod, requestID, objectID, message, answerRequired, netArgs, netKw)` Received a message-send.
| `_selectDialect(self, dialect)` (inherited from `Pynana`)
| ``_sendAnswer`(self, netResult, requestID)` (internal) Send an answer to a previously sent message.
| ``_sendError`(self, fail, requestID)` (internal) Send an error for a previously sent message.
| `_sendFailure(self, fail, requestID)`
| `_sendMessage(self, prefix, perspective, objectID, message, args, kw)`

Class Variable Summary
`int` | `maxBrokerRefsViolations`
`NoneType` | `username`
`int` | `version`
`NoneType` | `waitingForAnswers`

Method Details

### cachedRemotelyAs(self, instance, incref=0) Returns an ID that says what this instance is cached as remotely, or `None` if it's not.

### cacheLocally(self, cid, instance) (internal) Store a non-filled-out cached instance locally.

### cacheRemotely(self, instance) XXX

### connectionFailed(self) (Deprecated) This used to be called when the connection was not properly established. Overrides: `twisted.internet.protocol.Protocol.connectionFailed` (inherited documentation)

### connectionLost(self, reason) The connection was lost.

### connectionReady(self) Initialize.

### decCacheRef(self, objectID) (internal) Send a DECACHE directive.

### dontNotifyOnDisconnect(self, notifier) Remove a callback from list of disconnect callbacks.

### expressionReceived(self, sexp) Evaluate an expression as it's received.

### localObjectForID(self, luid) Get a local object for a locally unique ID. I will return an object previously stored with self.`registerReference`, or `None` if XXX:Unfinished thought:XXX

### newLocalID(self) Generate a new LUID.

### newRequestID(self) Generate a new request ID.

### notifyOnConnect(self, notifier) Call the given callback when the Broker connects.

### notifyOnDisconnect(self, notifier) Call the given callback when the Broker disconnects.

### notifyOnFail(self, notifier) Call the given callback if the Broker fails to connect.

### proto_answer(self, requestID, netResult) (internal) Got an answer to a previously sent message. Look up the appropriate callback and call it.

### proto_decache(self, objectID) (internal) Decrement the reference count of a cached object. If the reference count is zero, free the reference, then send an 'uncached' directive.

### proto_decref(self, objectID) (internal) Decrement the reference count of an object. If the reference count is zero, it will free the reference to this object.

### proto_didNotUnderstand(self, command) 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.)

### proto_error(self, requestID, fail) (internal) Deal with an error.

### proto_uncache(self, objectID) (internal) Tell the client it is now OK to uncache an object.

### proto_version(self, vnum) Protocol message: (version version-number) Check to make sure that both ends of the protocol are speaking the same version dialect.

### registerReference(self, object) Get an ID for a local object. Store a persistent reference to a local object and map its id() to a generated, session-unique ID and return that ID.

### remoteForName(self, name) 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.

### remotelyCachedForLUID(self, luid) Returns an instance which is cached remotely, with this LUID.

### resumeProducing(self) Called when the consumer attached to me runs out of buffer.

### sendCall(self, *exp) Utility method to send an expression to the other side of the connection.

### sendDecRef(self, objectID) (internal) Send a DECREF directive.

### serialize(self, object, perspective=None, method=None, args=None, kw=None) Jelly an object according to the remote security rules for this broker.

### setNameForLocal(self, name, object) 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.

### unserialize(self, sexp, perspective=None) Unjelly an sexp according to the local security rules for this broker.

### _recvMessage(self, findObjMethod, requestID, objectID, message, answerRequired, netArgs, netKw) 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.

### _sendAnswer(self, netResult, requestID) (internal) Send an answer to a previously sent message.

### _sendError(self, fail, requestID) (internal) Send an error for a previously sent message.

Class Variable Details

    ### maxBrokerRefsViolations Type: `int` Value:
        0

    ### username Type: `NoneType` Value:
        None

    ### version Type: `int` Value:
        6

    ### waitingForAnswers Type: `NoneType` Value:
        None

Generated by Epydoc 1.1 on Thu May 8 13:19:02 2003 | http://epydoc.sf.net