April 2024 - This site, and Kamaelia are being updated. There is significant work needed, and PRs are welcome.

Axon.Box.postbox

For examples and more explanations, see the module level docs.


class postbox(object)

postbox(storage[,notify]) -> new postbox object.

Creates a postbox, using the specified storage as default storage. Storage should have the interface of list objects.

Also takes optional notify callback, that will be called whenever an item is taken out of a postbox further down the chain.

Methods defined here

__init__(self, storage[, notify])

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

__len__(self)

Returns number of items in the postbox

__repr__(self)

_addnotifys(self, newnotifys)

Updates the local storage's list of notification callbacks for when messages are taken out of inboxes. Then recurses this info to this postbox's target, so it can update too.

_removenotifys(self, oldnotifys)

Updates the local storage's list of notification callbacks for when messages are taken out of inboxes. Then recurses this info to this postbox's target, so it can update too.

_retarget(self[, newtarget])

retarget([newtarget]) aims requests at to this postbox at a different target.

If newtarget is unspecified or None, target is default local storage.

addsource(self, newsource)

addsource(newsource) registers newsource as a source and tells it to 'retarget' at this postbox.

Also finds out from the new source who wants to be notified when messages are taken out of postboxes, and updates records accordingly, and passes this info further down the chain of linkages.

Raises Axon.AxonExceptions.BoxAlreadyLinkedToDestination if the newsource is already targetted at a destination. This is because Axon does not support one-to-many arrangements.

getSize(self)

Gets current box size limit

getnotifys(self)

Returns list of all callbacks that should be made when messages are collected from a postbox using this one as a source.

The list returned is effectively all callbacks this postbox would have to make plus the callback for the owner of this box (if there is one)

isFull(self)

Returns True if the destination box is full (and has a size limit)

removesource(self, oldsource)

removesource(oldsource) deregisters oldsource as a source and tells it to 'retarget' at None (nothing).

Also finds out from the old source who was being notified when messages are taken out of postboxes, and updates records accordingly, and passes this info further down the chain of linkages.

setShowTransit(self[, showtransit][, tag])

Set showTransit to True to cause debugging output whenever a message is delivered to this postbox. The tag can be anything you want to identify this occurrence.

setSize(self, size)

Set box size limit (use None for no limit)

Behaviour is undefined (and not recommended!) if this call is made whilst there may be items in the postbox!

Feedback

Got a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording!

Please leave you feedback here in reply to the documentation thread in the Kamaelia blog.

-- Automatic documentation generator, 09 Dec 2009 at 04:00:25 UTC/GMT