Table of Contents

Class: Broker | Twisted-0.17.4/twisted/spread/pb.py
--- | ---

I am a broker for objects.

Base Classes |
--- | ---
banana.Banana

Methods |
--- | ---

__init__
_recvMessage
_sendAnswer
_sendError
_sendFormattedFailure
_sendMessage
cacheLocally
cacheRemotely
cachedLocallyAs
cachedRemotelyAs
connectionFailed
connectionLost
connectionReady

decCacheRef
dontNotifyOnDisconnect
expressionReceived
localObjectForID
newLocalID
newRequestID
notifyOnConnect
notifyOnDisconnect
notifyOnFail
proto_answer
proto_cachemessage
proto_decache
proto_decref

proto_didNotUnderstand
proto_error
proto_message
proto_uncache
proto_version
registerReference
remoteForName
remotelyCachedForLUID
sendCall
sendDecRef
serialize
setNameForLocal
unserialize

| __init__

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

| _recvMessage

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

Exceptions |
--- | ---
Error( "Invalid Object ID" )

| _sendAnswer

    _sendAnswer (
            self,
            netResult,
            requestID,
            )

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

| _sendError

    _sendError (
            self,
            descriptiveString,
            requestID,
            )

(internal) Send an error for a previously sent message.

| _sendFormattedFailure

    _sendFormattedFailure (
            self,
            error,
            requestID,
            )

| _sendMessage

    _sendMessage (
            self,
            prefix,
            perspective,
            objectID,
            message,
            args,
            kw,
            )

Exceptions |
--- | ---
ProtocolError( "Calling Stale Broker" )

| cacheLocally

    cacheLocally (
            self,
            cid,
            instance,
            )

### (internal)

Store a non-filled-out cached instance locally.

| cacheRemotely

    cacheRemotely ( self,  instance )

XXX

| cachedLocallyAs

    cachedLocallyAs ( self,  cid )

| cachedRemotelyAs

    cachedRemotelyAs (
            self,
            instance,
            incref=0,
            )

Returns an ID that says what this instance is cached as remotely, or None if it's not.

| connectionFailed

    connectionFailed ( self )

| connectionLost

    connectionLost ( self )

The connection was lost.

| connectionReady

    connectionReady ( self )

Initialize.

| decCacheRef

    decCacheRef ( self,  objectID )

(internal) Send a DECACHE directive.

| dontNotifyOnDisconnect

    dontNotifyOnDisconnect ( self,  notifier )

Remove a callback from list of disconnect callbacks.

| expressionReceived

    expressionReceived ( self,  sexp )

Evaluate an expression as it's received.

Exceptions |
--- | ---
ProtocolError( "Non-list expression received." )

| localObjectForID

    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

    newLocalID ( self )

Generate a new LUID.

| newRequestID

    newRequestID ( self )

Generate a new request ID.

| notifyOnConnect

    notifyOnConnect ( self,  notifier )

Call the given callback when the Broker connects.

| notifyOnDisconnect

    notifyOnDisconnect ( self,  notifier )

Call the given callback when the Broker disconnects.

| notifyOnFail

    notifyOnFail ( self,  notifier )

Call the given callback if the Broker fails to connect.

| proto_answer

    proto_answer (
            self,
            requestID,
            netResult,
            )

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

Look up the appropriate callback and call it.

| proto_cachemessage

    proto_cachemessage (
            self,
            requestID,
            objectID,
            message,
            answerRequired,
            netArgs,
            netKw,
            )

| proto_decache

    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

    proto_decref ( self,  objectID )

### (internal) Decrement the refernce count of an object.

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

| proto_didNotUnderstand

    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

    proto_error (
            self,
            requestID,
            descriptiveString,
            )

(internal) Deal with an error.

| proto_message

    proto_message (
            self,
            requestID,
            objectID,
            message,
            answerRequired,
            netArgs,
            netKw,
            )

| proto_uncache

    proto_uncache ( self,  objectID )

(internal) Tell the client it is now OK to uncache an object.

| proto_version

    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.

Exceptions |
--- | ---
ProtocolError("Version Incompatibility: %s %s" %( self.version, vnum ) )

| registerReference

    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

    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

    remotelyCachedForLUID ( self,  luid )

Returns an instance which is cached remotely, with this LUID.

| sendCall

    sendCall ( self,  *exp )

Utility method to send an expression to the other side of the connection.

| sendDecRef

    sendDecRef ( self,  objectID )

(internal) Send a DECREF directive.

| serialize

    serialize (
            self,
            object,
            perspective=None,
            method=None,
            args=None,
            kw=None,
            )

Jelly an object according to the remote security rules for this broker.

| setNameForLocal

    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

    unserialize (
            self,
            sexp,
            perspective=None,
            )

Unjelly an sexp according to the local security rules for this broker.

Table of Contents

This document was automatically generated on Sat Apr 20 01:31:32 2002 by HappyDoc version 2.0