Reporters and Injectors

Reporter

class zircon.reporters.base.Reporter(transceiver, transformers=None, publisher=None)[source]

A Reporter continuously reads data from a Transceiver, feeds it through a row of Transformers, and broadcasts the result using a Publisher.

When creating a Reporter, you supply instances of a Transceiver, one or more Transformers, and a Publisher. If not specified, a pickling Transformer and the default Publisher are used.

Usage:

reporter = Reporter(
    transceiver=MyTransceiver(),
    transformers=[MyDecoder(), MyCompressor(), ...],
    publisher=MyPublisher()
)

A Reporter can be run as its own process:

reporter.run()

Or stepped through by an external engine:

reporter.open()
while not done:
    reporter.step()
open()[source]

Initialize the Transceiver and Publisher.

step()[source]

Read data and feed it into the first Transformer.

run()[source]

Initialize components and start broadcasting.

Injector

class zircon.injectors.base.Injector(subscriber=None, transformers=None, datastore=None)[source]

An Injector listens for data from a Reporter, feeds it through a row of Transformers, and inserts the result into a Datastore.

When creating an Injector, you supply instances of a Subscriber, one or more Transformers, and a Datastore. If not specified, an unpickling Transformer and the default Subscriber and Datastore are used.

Usage:

injector = Injector(
    subscriber=MySubscriber(),
    transformers=[MyDecompressor(), MyFormatter(), ...],
    datastore=MyDatastore()
)

An Injector can be run as its own process:

injector.run()

Or stepped through by an external engine:

injector.open()
while not done:
    injector.step()
open()[source]

Initialize the Subscriber.

step()[source]

Receive data and feed it into the first Transformer.

run()[source]

Initialize components and start listening.