Whad generic stack model reference
Decorators
- class whad.common.stack.source(source, tag='default', contextual=False)[source]
Layer method decorator to perform source matching.
Source matching can be done on layer name and optionally a tag (some user-defined text used to represent a specific state or operation).
This tag is used to dispatch the incoming data to the correct callback, each callback accepting additional named arguments as specified by the implementer.
Layer classes
- class whad.common.stack.Layer(parent=None, layer_name=None, options={})[source]
Basic stack layer.
- configure(options)[source]
Configure callback.
Override this method to configure the layer when the stack is instanciated.
- create_layer(layer_class, inst_name)[source]
Create a layer and registers it into our list of layers.
- get_handler(source, tag='default')[source]
Retrieve the registered handler for a given source and tag (if any).
- has_handler(source, tag='default')[source]
Check if this layer has a registered method to process messages coming from a specific source/tag.
- populate(options={})[source]
Sub-layers instanciation.
We instanciate each layer and register these instances into our object.
- register_monitor_callback(callback)[source]
Register a callback to monitor messages sent between layers.
- send(destination, data, tag='default', **kwargs)[source]
Send a message to the corresponding layer.
- send_from(source, destination, data, tag='default', **kwargs)[source]
Dispatch data from source to destination, with an optional tag and arguments.
- state_class
alias of
LayerState
Unit testing
- class whad.common.stack.tests.Sandbox(parent=None, layer_name=None, options={}, target=None)[source]
This layer is used as a container for one or more layers that need to be tested.
- get_handler(source, tag)[source]
This method is called by our stack message handler search code, and is required here to return our dummy message handler.