Package spoon :: Package transports :: Module transporthub :: Class TransportHub
[hide private]
[frames] | no frames]

Class TransportHub

source code

object --+
         |
        TransportHub

Where all of your transports connect to form your glorious new node.

Instance Methods [hide private]

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


Static Methods [hide private]
  setLogger(logger)
Sets a logger object for SpoonRPC to use.
  addTransport(t)
Must be called after a transport is initialized to initiate the spoonRPC protocol.
  removeTransport(t)
Must be called after a transport has been made inactive.

Class Variables [hide private]
  activeTransports = []
A simple list of the transports that are currently active
  links = {}
A dict, keys are the node id of the directly connected neighbor and the values are the associated transport
int nodeId = None
The local node id.
  _log = NullLogger()

Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

setLogger(logger)
Static Method

source code 

Sets a logger object for SpoonRPC to use.

This can be a python logger object, or just anything that supports that general protocol. It defaults to NullLogger which does nothing with the messages.
Decorators:

addTransport(t)
Static Method

source code 
Must be called after a transport is initialized to initiate the spoonRPC protocol.
Parameters:
  • t - The transport being initialized
Returns:
Nothing
Decorators:
Raises:

removeTransport(t)
Static Method

source code 
Must be called after a transport has been made inactive.
Decorators:

Class Variable Details [hide private]

activeTransports

A simple list of the transports that are currently active
Value:
[]                                                                     
      

links

A dict, keys are the node id of the directly connected neighbor and the values are the associated transport
Value:
{}                                                                     
      

nodeId

The local node id. This must be set to the node's integer id before the spoon transport hub is started. The nodeId is just a network wide, unique int. How this is determined is left as an excercise for the implementation. In most cases, it should probably be something that is constant for the host/program between instances.
Type:
int
Value:
None                                                                  
      

_log

None
Value:
NullLogger()