Package twisted :: Package sibling :: Module siblingserv :: Class SiblingService
[frames | no frames]

Class SiblingService

           Perspective --+    
                         |    
               Perspective --+
                             |
      Accessor --+           |
                 |           |
     Versioned --+           |
                 |           |
ApplicationService --+       |
                     |       |
               Service --+   |
                         |   |
                   Service --+
                             |
                            SiblingService


A 'sibling' object, managed by a mother server

I am one of a set of siblings managed by a mother server. I use the mother server as a central manager of distributed objects, and as a mechanism for communicating to other sibling servers.

Distributed login into me is handled by passing identity resources - which I have a special loader and authorizer for.
Method Summary
  __init__(self, motherHost, motherPort, motherService, publishHost, localPort, serviceName, sharedSecret, application)
Initialize me.
  __getstate__(self)
  _cbLocked(self, result, path)
  _cbUnload(self, data)
  _ebLocked(self, error, path)
  callDistributed(self, caller, destResourceType, destResourceName, methodName, *args, **kw)
Call a distributed method on a resource managed by the sibling network.
  loadResource(self, resourceType, resourceName, args)
Returns a Deferred when the resource is loaded.
  ownResource(self, resourceObject, resourceType, resourceName)
  registerResourceLoader(self, resourceType, resourceLoader)
Register a callable object to generate resources.
  removeIdentity(self, identityName)
  startService(self)
This call is made as a service starts up.
  unloadResource(self, resourceType, resourceName)
    Inherited from Service
  addPerspective(self, perspective)
Add a perspective to this Service.
  cachePerspective(self, perspective)
Cache a perspective loaded from an external data source.
  createPerspective(self, name)
Create a perspective from self.perspectiveClass and add it to this service.
  getPerspectiveForIdentity(self, name, identity)
A hook to use if the identity is required when getting the perspective.
  getPerspectiveNamed(self, name)
Return a perspective that represents a user for this service.
  getPerspectiveRequest(self, name)
Return a Deferred which is a request for a perspective on this service.
  getServiceName(self)
The name of this service.
  getServiceType(self)
Get a string describing the type of this service.
Deferred Perspective loadPerspective(self, name)
Load a perspective from an external data-source.
  setServiceParent(self, parent)
  uncachePerspective(self, perspective)
Uncache a perspective loaded from an external data source.
    Inherited from ApplicationService
  disownServiceParent(self)
Have my parent disown me.
  get_application(self)
  set_application(self, application)
  setApplication(self, application)
  stopService(self)
This call is made before shutdown.
  upgradeToVersion1(self)
    Inherited from Accessor
  __delattr__(self, k)
  __getattr__(self, k)
  __setattr__(self, k, v)
  reallyDel(self, k)
*actually* del self.k without incurring side-effects.
  reallySet(self, k, v)
*actually* set self.k to v without incurring side-effects.
    Inherited from Versioned
  __setstate__(self, state)
  versionUpgrade(self)
(internal) Do a version upgrade.
    Inherited from Perspective
  brokerAttached(self, reference, identity, broker)
An intermediary method to override.
  brokerDetached(self, reference, identity, broker)
See brokerAttached.
  perspectiveMessageReceived(self, broker, message, args, kw)
This method is called when a network message is received.
    Inherited from Perspective
  attached(self, reference, identity)
Called when a remote reference is 'attached' to me.
  detached(self, reference, identity)
Called when a broker is 'detached' from me.
  getIdentityRequest(self)
Request my identity.
  getPerspectiveName(self)
Return the unique name of this perspective.
  getService(self)
Return a service.
  isCached(self)
  makeIdentity(self, password)
Make an identity from this perspective with a password.
  setCached(self)
  setIdentity(self, ident)
Determine which identity I connect to.
  setIdentityName(self, name)
  setService(self, service)
Change what service I am a part of.

Class Variable Summary
    Inherited from Service
NoneType serviceName = None                                                                  
NoneType serviceType = None                                                                  
    Inherited from ApplicationService
int persistenceVersion = 1                                                                     
NoneType serviceParent = None                                                                  
int serviceRunning = 0                                                                     
    Inherited from Versioned
tuple persistenceForgets = ()
    Inherited from Perspective
tuple __implements__ = (<class twisted.cred.perspective.IPersp...
int _attachedCount = 0                                                                     
int _service_cached = 0                                                                     

Method Details

__init__(self, motherHost, motherPort, motherService, publishHost, localPort, serviceName='twisted.sibling', sharedSecret='shhh!', application=None)
(Constructor)

Initialize me.

(Application's authorizer must be a TicketAuthorizer, otherwise login won't work.)
Overrides:
twisted.cred.service.Service.__init__

callDistributed(self, caller, destResourceType, destResourceName, methodName, *args, **kw)

Call a distributed method on a resource managed by the sibling network. This will call the method 'getResourceInfo' on the calling object which must return its resourceType and resourceName to be identified by. The final method being called will have 'sibling_' prepended to its name and have the calling objects resourceType and resourceName as the first arguments.

NOTE: this method of identifying the calling object is temporary.. need to establish a better way which includes allowing the calling object to expose some data and/or functionality to the caller.

loadResource(self, resourceType, resourceName, args)

Returns a Deferred when the resource is loaded. This deferred may yield some data that is returned to the caller.

registerResourceLoader(self, resourceType, resourceLoader)

Register a callable object to generate resources.

The callable object may return Deferreds or synchronous values.

startService(self)

This call is made as a service starts up.
Overrides:
twisted.internet.app.ApplicationService.startService (inherited documentation)

Generated by Epydoc 2.0 on Sat Sep 13 04:20:54 2003 http://epydoc.sf.net