spoon.messaging.messaging.Messaging

Package spoon :: Package messaging :: Module messaging :: Class Messaging |
[show private | hide private]
[frames | no frames]

## Type Messaging

    object --+
             |
            Messaging

Known Subclasses:
  `SingletonMessaging`

This is the main messaging class that implements the basic functionality for Spoon. Messaging implementations that need specific functionality (such as reliablility) will probably want to subclass from this.

There may be multiple instances of Messaging per python process, however there should only be one per network to which a node is a member. There may be a case where one would want a single Messaging instance shared between networks however, and as long as the node ids on the networks do not overlap, you shouldn't have any problems.

You cannot use the acceptMsg decorator with this, for that you have to use the SingletonMessaging class. To register handlers with instances of Messaging, you must use the registerHandler method on the Messaging instance.

Method Summary
| `__init__(self, network)`
| ``handleMessage`(self, src, msg)` Calls the all handlers for the given message.
| `registerHandler(self, msgtype, handler)`
| ``send`(self, dst, messageStr, obj)` Sends a Messaging message (not just a NetMessage) to the destination node.
| `setNetwork(self, network)`
| `unregisterHandler(self, msgtype, handler)`
Inherited from object
| ``__delattr__`(...)` x.__delattr__('name') <==> del x.name
| ``__getattribute__`(...)` x.__getattribute__('name') <==> x.name
| ``__hash__`(x)` x.__hash__() <==> hash(x)
| ``__new__`(T, S, ...)` T.__new__(S, ...) -> a new object with type S, a subtype of T
| ``__reduce__`(...)` helper for pickle
| ``__reduce_ex__`(...)` helper for pickle
| ``__repr__`(x)` x.__repr__() <==> repr(x)
| ``__setattr__`(...)` x.__setattr__('name', value) <==> x.name = value
| ``__str__`(x)` x.__str__() <==> str(x)

Method Details

### handleMessage(self, src, msg) Calls the all handlers for the given message. Parameters: `src` - The source node of the message `msg` - A list containing the message type, and the attached object.

### send(self, dst, messageStr, obj) Sends a Messaging message (not just a NetMessage) to the destination node. Parameters: `dst` - Destination node id `messageStr` - A string describing the message type. `obj` - Some object attached the net message.

Generated by Epydoc 2.1 on Sun Nov 26 15:33:58 2006 | http://epydoc.sf.net