Package foolscap :: Module ipb :: Class IRemoteReference
[hide private]
[frames] | no frames]

Class IRemoteReference

source code

zope.interface.Interface --+
                           |
                          IRemoteReference

This marks a RemoteReference.

Instance Methods [hide private]
 
notifyOnDisconnect(callback, *args, **kwargs)
Register a callback to run when we lose this connection.
source code
 
dontNotifyOnDisconnect(cookie)
Deregister a callback that was registered with notifyOnDisconnect.
source code
 
callRemote(name, *args, **kwargs)
Invoke a method on the remote object with which I am associated.
source code
 
callRemoteOnly(name, *args, **kwargs)
Invoke a method on the remote object with which I am associated.
source code
Class Variables [hide private]
  _InterfaceClass__attrs = {'callRemote': <zope.interface.interf...
  __bases__ = (<InterfaceClass zope.interface.Interface>)
  __identifier__ = 'foolscap.ipb.IRemoteReference'
  __iro__ = (<InterfaceClass foolscap.ipb.IRemoteReference>, <In...
  __name__ = 'IRemoteReference'
  __sro__ = (<InterfaceClass foolscap.ipb.IRemoteReference>, <In...
  _implied = {<InterfaceClass foolscap.ipb.IRemoteReference>: ()...
  dependents = <WeakKeyDictionary at 139785036>

Inherited from zope.interface.Interface (private): _Element__tagged_values

Method Details [hide private]

notifyOnDisconnect(callback, *args, **kwargs)

source code 

Register a callback to run when we lose this connection.

The callback will be invoked with whatever extra arguments you provide to this function. For example:

def my_callback(name, number):
    print name, number+4
cookie = rref.notifyOnDisconnect(my_callback, 'bob', number=3)

This function returns an opaque cookie. If you want to cancel the notification, pass this same cookie back to dontNotifyOnDisconnect:

rref.dontNotifyOnDisconnect(cookie)

Note that if the Tub is shutdown (via stopService), all notifyOnDisconnect handlers are cancelled.

callRemote(name, *args, **kwargs)

source code 

Invoke a method on the remote object with which I am associated.

I always return a Deferred. This will fire with the results of the method when and if the remote end finishes. It will errback if any of the following things occur:

the arguments do not match the schema I believe is in use by the
far end (causes a Violation exception)

the connection to the far end has been lost (DeadReferenceError)

the arguments are not accepted by the schema in use by the far end
(Violation)

the method executed by the far end raises an exception (arbitrary)

the return value of the remote method is not accepted by the schema
in use by the far end (Violation)

the connection is lost before the response is returned
(ConnectionLost)

the return value is not accepted by the schema I believe is in use
by the far end (Violation)

callRemoteOnly(name, *args, **kwargs)

source code 

Invoke a method on the remote object with which I am associated.

This form is for one-way messages that do not require results or even acknowledgement of completion. I do not wait for the method to finish executing. The remote end will be instructed to not send any response. There is no way to know whether the method was successfully delivered or not.

I always return None.


Class Variable Details [hide private]

_InterfaceClass__attrs

Value:
{'callRemote': <zope.interface.interface.Method object at 0x854f56c>,
 'callRemoteOnly': <zope.interface.interface.Method object at 0x854f66\
c>,
 'dontNotifyOnDisconnect': <zope.interface.interface.Method object at \
0x854f46c>,
 'notifyOnDisconnect': <zope.interface.interface.Method object at 0x85\
4f38c>}

__iro__

Value:
(<InterfaceClass foolscap.ipb.IRemoteReference>,
 <InterfaceClass zope.interface.Interface>)

__sro__

Value:
(<InterfaceClass foolscap.ipb.IRemoteReference>,
 <InterfaceClass zope.interface.Interface>)

_implied

Value:
{<InterfaceClass foolscap.ipb.IRemoteReference>: (),
 <InterfaceClass zope.interface.Interface>: ()}