Module flod

High-level interface for flod. Provides the most commonly used functions of the package.

Package description

flod is a library for processing streams of data using composable building blocks.

In flod, a pipeline is a chain of one or more stages, which communicate with each other using the specified interfaces.

A stage can be either a source, a sink, or a filter, which is both a sink and a source. A source-only stage is one that only produces data, e.g. reads a file or generates random bytes. A sink-only stage is one that only consumes data from previous stages. For example, a sink may use the data to build an array or replay audio samples. A filter stage receives data on its sink end, and produces transformed data on its source end. Examples of such stages are media decoders or cipher implementations.

There are four methods of passing data from a source to a sink:

method description buffer is owned by
pull sink calls source.pull() sink
push source calls sink.push() source
peek sink calls source.peek() and source.consume() source
alloc source calls sink.alloc() and sink.commit() sink

Note that a filter can use different methods for its sink and source ends. For example, it may call peek and consume to access the input data, and output transformed data using push.

Authors

Adrian Matoga

Copyright

© 2016 Adrian Matoga

License

BSL-1.0.