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

Class Broker



internet.protocol.BaseProtocol --+        
                                 |        
        internet.protocol.Protocol --+    
                                     |    
        persisted.styles.Ephemeral --+    
                                     |    
                         banana.Banana --+
                                         |
                                        Broker

I am a broker for objects.

Instance Methods [hide private]
 
__init__(self, isClient=1, security=globalSecurity)
 
resumeProducing(self)
Called when the consumer attached to me runs out of buffer.
 
pauseProducing(self)
 
stopProducing(self)
 
registerPageProducer(self, pager)
 
expressionReceived(self, sexp)
Evaluate an expression as it's received.
 
proto_version(self, vnum)
Protocol message: (version version-number)
 
sendCall(self, *exp)
Utility method to send an expression to the other side of the connection.
 
proto_didNotUnderstand(self, command)
Respond to stock 'didNotUnderstand' message.
 
connectionReady(self)
Initialize.
 
connectionFailed(self)
 
connectionLost(self, reason)
The connection was lost.
 
notifyOnDisconnect(self, notifier)
Call the given callback when the Broker disconnects.
 
notifyOnFail(self, notifier)
Call the given callback if the Broker fails to connect.
 
notifyOnConnect(self, notifier)
Call the given callback when the Broker connects.
 
dontNotifyOnDisconnect(self, notifier)
Remove a callback from list of disconnect callbacks.
 
localObjectForID(self, luid)
Get a local object for a locally unique ID.
 
registerReference(self, object)
Get an ID for a local object.
 
setNameForLocal(self, name, object)
Store a special (string) ID for this object.
 
remoteForName(self, name)
Returns an object from the remote name mapping.
 
cachedRemotelyAs(self, instance, incref=0)
Returns an ID that says what this instance is cached as remotely, or None if it's not.
 
remotelyCachedForLUID(self, luid)
Returns an instance which is cached remotely, with this LUID.
 
cacheRemotely(self, instance)
XXX
 
cacheLocally(self, cid, instance)
(internal)
 
cachedLocallyAs(self, cid)
 
serialize(self, object, perspective=None, method=None, args=None, kw=None)
Jelly an object according to the remote security rules for this broker.
 
unserialize(self, sexp, perspective=None)
Unjelly an sexp according to the local security rules for this broker.
 
newLocalID(self)
Generate a new LUID.
 
newRequestID(self)
Generate a new request ID.
 
_sendMessage(self, prefix, perspective, objectID, message, args, kw)
 
proto_message(self, requestID, objectID, message, answerRequired, netArgs, netKw)
 
proto_cachemessage(self, requestID, objectID, message, answerRequired, netArgs, netKw)
 
_recvMessage(self, findObjMethod, requestID, objectID, message, answerRequired, netArgs, netKw)
Received a message-send.
 
_sendAnswer(self, netResult, requestID)
(internal) Send an answer to a previously sent message.
 
proto_answer(self, requestID, netResult)
(internal) Got an answer to a previously sent message.
 
_sendFailureOrError(self, fail, requestID)
Call _sendError or _sendFailure, depending on whether fail represents an Error subclass or not.
 
_sendFailure(self, fail, requestID)
Log error and then send it.
 
_sendError(self, fail, requestID)
(internal) Send an error for a previously sent message.
 
proto_error(self, requestID, fail)
(internal) Deal with an error.
 
sendDecRef(self, objectID)
(internal) Send a DECREF directive.
 
proto_decref(self, objectID)
(internal) Decrement the reference count of an object.
 
decCacheRef(self, objectID)
(internal) Send a DECACHE directive.
 
proto_decache(self, objectID)
(internal) Decrement the reference count of a cached object.
 
proto_uncache(self, objectID)
(internal) Tell the client it is now OK to uncache an object.

Inherited from banana.Banana: callExpressionReceived, connectionMade, dataReceived, gotItem, sendEncoded, setPrefixLimit

Inherited from banana.Banana (private): _encode, _selectDialect

Inherited from internet.protocol.BaseProtocol: __providedBy__, makeConnection

Inherited from persisted.styles.Ephemeral: __getstate__, __setstate__

Class Variables [hide private]
  version = 6
  username = None
  factory = None
  waitingForAnswers = None
  maxBrokerRefsViolations = 0

Inherited from banana.Banana: buffer, incomingVocabulary, k, knownDialects, outgoingVocabulary, prefixLimit, sizeLimit, v

Inherited from internet.protocol.Protocol: __implemented__, __provides__

Inherited from internet.protocol.BaseProtocol: connected, transport

Method Details [hide private]

__init__(self, isClient=1, security=globalSecurity)
(Constructor)

 
Overrides: banana.Banana.__init__

expressionReceived(self, sexp)

 
Evaluate an expression as it's received.
Overrides: banana.Banana.expressionReceived

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.

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.)

connectionReady(self)

 
Initialize. Called after Banana negotiation is done.
Overrides: banana.Banana.connectionReady

connectionLost(self, reason)

 
The connection was lost.
Overrides: internet.protocol.Protocol.connectionLost

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

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.

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.

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.

cacheLocally(self, cid, instance)

 

(internal)

Store a non-filled-out cached instance locally.

_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.

proto_answer(self, requestID, netResult)

 

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

Look up the appropriate callback and call it.

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_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.