Package foolscap :: Module referenceable :: Class RemoteReferenceOnly
[hide private]
[frames] | no frames]

Class RemoteReferenceOnly

source code

object --+
         |
        RemoteReferenceOnly
Known Subclasses:

Instance Methods [hide private]
 
__init__(self, tracker)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
getSturdyRef(self) source code
 
getRemoteTubID(self) source code
 
getPeer(self)
Return an IAddress-providing object that describes the remote peer.
source code
 
notifyOnDisconnect(self, callback, *args, **kwargs)
Register a callback to run when we lose this connection.
source code
 
dontNotifyOnDisconnect(self, marker) source code
 
__repr__(self)
repr(x)
source code
 
__providedBy__(...)
Object Specification Descriptor

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Class Variables [hide private]
  __implemented__ = <implementedBy foolscap.referenceable.Remote...
  __provides__ = <zope.interface.declarations.ClassProvides obje...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, tracker)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • tracker - the RemoteReferenceTracker which points to us
Overrides: object.__init__

getPeer(self)

source code 

Return an IAddress-providing object that describes the remote peer. If we've connected to ourselves, this will be a foolscap.broker.LoopbackAddress instance. If we've connected to someone else, this will be a twisted.internet.address.IPv4Address instance, with .host and .port attributes.

notifyOnDisconnect(self, 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.

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

Class Variable Details [hide private]

__implemented__

Value:
<implementedBy foolscap.referenceable.RemoteReferenceOnly>

__provides__

Value:
<zope.interface.declarations.ClassProvides object at 0x881eecc>