Package spoon :: Package transports :: 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.

Important you must set the nodeId on this object to something unique for the networks you are joining in order for things to work.

Instance Methods [hide private]

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


Static Methods [hide private]
  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.
  setLogger(logger)
Sets a logger object for SpoonRPC to use.

Class Variables [hide private]
  _log = <spoon.NullLogger object at 0xa7adc6ec>
  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.

Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

addTransport(t)
Static Method

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

removeTransport(t)
Static Method

 
Must be called after a transport has been made inactive.

setLogger(logger)
Static Method

 

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.

Class Variable Details [hide private]

_log

None
Value:
<spoon.NullLogger object at 0xa7adc6ec>                                
      

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