The zaqar.common.pipeline module

This module implements a common Pipeline object.

The pipeline can be used to enhance the storage layer with filtering, routing, multiplexing and the like. For example:

>>> stages = [MessageFilter(), EncryptionFilter(), QueueController()]
>>> pipeline = Pipeline(stages)

Every stage has to implement the method it wants to hook into. This method will be called when the pipeline consumption gets to that point - stage ordering matters - and will continue unless the method call returns a value that is not None.

At least one of the stages has to implement the calling method. If none of them do, an AttributeError exception will be raised.

class Pipeline(pipeline=None)

Bases: object

consumer_for(*args, **kwds)

Creates a closure for method

This method creates a closure to consume the pipeline for method.

Params method:The method name to call on each stage
Returns:A callable to consume the pipeline.