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

Kamaelia.Protocol.SimpleReliableMulticast

Simple Reliable Multicast

A pair of Pipelines for encoding (and decoding again) a stream of data such that is can be transported over an unreliable connection that may lose, duplicate or reorder data.

These components will ensure that data arrives in the right order and that duplicates are removed. However it cannot recover lost data.

Example Usage

Reliably transporting a file over multicast (assuming no packets are lost):

Pipeline(RateControlledFileReader("myfile"),
         SRM_Sender(),
         Multicast_transceiver("0.0.0.0", 0, "1.2.3.4", 1000),
        ).activate()

On the client:

class discardSeqnum(component):
    def main(self):
        while 1:
            if self.dataReady("inbox"):
                (_, data) = self.recv("inbox")
                self.send(data,"outbox")

Pipeline( Multicast_transceiver("0.0.0.0", 1000, "1.2.3.4", 0)
          SRM_Receiver(),
          discardSeqnum(),
          ConsoleEchoer()
        ).activate()

How does it work?

SRM_Sender is a Pipeline of three components:

  • Annotator -- annotates a data stream with sequence numbers
  • Framer -- frames the data
  • DataChunker -- inserts markers between frames

SRM_Receiver is a Pipeline of three components:

  • DataDeChunker -- recovers chunks based on markers
  • DeFramer -- removes framing
  • RecoverOrder -- sorts data by sequence numbers

These components will ensure that data arrives in the right order and that duplicates are removed. However it cannot recover lost data. But the final output is (seqnum,data) pairs - so there is enough information for the receiver to know that data has been lost.

The Annotator component receives data on its "inbox" inbox, and emits (seqnum, data) tuples on its "outbox" outbox. The sequence numbers start at 1 and increments by 1 for each item.

The Annotator component does not terminate and ignores messages arriving on its "control" inbox.

See documentation for the other components for details of their design and behaviour.


Kamaelia.Protocol.SimpleReliableMulticast.Annotator

class Annotator(Axon.Component.component)

Annotator() -> new Annotator component.

Takes incoming data and outputs (n, data) where n is an incrementing sequence number, starting at 1.

Inboxes

Outboxes

Methods defined here

Warning!

You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers.

main(self)

Main loop

Kamaelia.Protocol.SimpleReliableMulticast.RecoverOrder

class RecoverOrder(Axon.Component.component)

RecoverOrder() -> new RecoverOrder component.

Receives and buffers (seqnum, data) pairs, and reorders them by ascending sequence number and emits them (when its internal buffer is full).

Inboxes

Outboxes

Methods defined here

Warning!

You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers.

main(self)

Main loop.

Kamaelia.Protocol.SimpleReliableMulticast.SRM_Receiver

prefab: SRM_Receiver

Simple Reliable Multicast receiver.

Dechunks, deframes and recovers the order of a data stream that has been encoded by SRM_Sender.

Final emitted data is (seqnum, data) pairs.

This is a Pipeline of components.

Kamaelia.Protocol.SimpleReliableMulticast.SRM_Sender

prefab: SRM_Sender

Simple Reliable Multicast sender.

Sequence numbers, frames and chunks a data stream, making it suitable for sending over an unreliable connection that may lose, reorder or duplicate data. Can be decoded by SRM_Receiver.

This is a Pipeline of components.

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, 05 Jun 2009 at 03:01:38 UTC/GMT