flows12171%python.module
fault.kernel

Channel Processors used to construct conceptual Flows.

A Channel represents an individual segment in a conceptual Flow. Channels connect together like UNIX pipes, but transfer typed messages (objects) instead of just data.

sys
import

collections0
import

functools0
import

weakref0
import

typing0
import

queue0
import

core0
import

Event0
class

Signal objects used to communicate flow control operations for subflow management. These objects are used by Catenation and Division to index operations.

Event__slots__0
data

__slots__ = ()

Event__int__0
method

__int__(self)

Event__repr__0
method

__repr__(self)

Event__str__0
method

__str__(self)

fe_initiate0
data

fe_initiate = Event()

fe_clear0
data

fe_clear = Event()

fe_transfer0
data

fe_transfer = Event()

fe_obstruct0
data

fe_obstruct = Event()

fe_terminate0
data

fe_terminate = Event()

flow_events0
data

flow_events = (
	fe_terminate,
	fe_obstruct,
	fe_transfer,
	fe_clear,
	fe_initiate,
)

Channel0
class

A Processor consisting of an arbitrary set of operations that can connect to other Channel instances in order to make a series of transformations.

Channels are the primary mechanism used to stream events; generally, anything that's a stream should be managed by Channel instances in favor of other event callback mechanisms.

ChannelProperties

f_type

The flow type describing what the instance does. This property can be None at the class level, but should be initialized when an instance is created.

source

Channel that primarily emits independent events for downstream processing.

terminal

Channel processes events, but emits nothing.

switch

Channel that takes events and distributes their transformation to a mapping of receiving flows.

join

Channel that receives events from a set of sources and combines them into a single stream.

transformer

Channel emits events strictly in response to processing. Transformers may buffer events as needed.

None

Unspecified type.

f_obstructions
None

No obstructions present.

typing.Mapping

The objects that are obstructing the Channel from performing processing associated with the exact condition causing it.

f_monitors

The set of callbacks used to signal changes in the flow's f_obstructed state.

None

No monitors watching the flow state.

f_downstream

The Channel instance that receives events emitted by the instance holding the attribute.

Channelf_type
data

f_type = None

Channelf_obstructions
data

f_obstructions = None

Channelf_monitors
data

f_monitors = None

Channelf_downstream
data

f_downstream = None

Channelf_upstream
data

f_upstream = None

Channelf_connect185%
method

f_connect(self, flow)

Connect the Channel to the given object supporting the Flow interface. Normally used with other Channels, but other objects may be connected.

Downstream is not notified of upstream obstructions. Events run downstream and obstructions run up.

Channelf_disconnect50%
method

f_disconnect(self)

Disconnect from the downstream and cease emitting events into f_downstream.

Channelf_collapse90%
method

f_collapse(self)

Connect the upstream to the downstream leaving the Channel self in a disconnected state with the old references remaining in place.

Channelf_substitute40%
method

f_substitute(self, series)

Channel__repr__10%
method

__repr__(self)

Channelstructure40%
method

structure(self)

Reveal the obstructions and monitors of the Channel.

Channelterminate0
method

terminate(self)

Drain the Channel and finish termination by signalling the controller of its exit.

Channelf_terminate0
method

f_terminate(self)

Termination signal received when the upstream no longer has flow transfers for the downstream Channel.

Channel_f_terminated0
method

_f_terminated(self)

Used by subclasses to issue downstream termination and exit.

Subclasses must call this or perform equivalent actions when termination of the conceptual flow is complete.

Channelinterrupt0
method

interrupt(self)

Channelf_transfer0
method

f_transfer(self, event)

Emit the event directly to the downstream.

Channelf_emit0
method

f_emit(self, event)

Method replaced at runtime for selecting the recipient of a processed event.

Channelf_empty10%
property

Whether the flow is actively performing a transfer.

This property returns True in cases where the Channel's state is such that it may independently send events downstream.

Channels that have buffers should implement this method.

Channelf_obstructed0
property

Whether or not the Channel is obstructed.

Channelf_permanent420%
property
int

Whether or not there are Inexorable obstructions present. An integer specifying the number of Inexorable obstructions or None if there are no obstructions.

Channelf_obstruct0
method

f_obstruct(self, by)

Instruct the Channel to signal the cessation of transfers. The cessation may be permanent depending on the condition.

Channelf_clear0
method

f_clear(self, obstruction)

Clear the obstruction by the key given to obstruction.

Channelf_watch0
method

f_watch(self, obstructed, cleared)

Assign the given functions as callbacks to obstruction events. First called when an obstruction occurs and second when its cleared.

Channelf_ignore0
method

f_ignore(self, obstructed, cleared)

Stop watching the Flow's obstructed state.

Channelf_discarding0
method

f_discarding(self)

Assigned to process and f_emit after termination and interrupt in order to keep overruns from exercising the Transformations.

Dispatch0
class

Channel dispatching events to the configured callable.

Dispatch__init__10%
method

__init__(self, endpoint)

Dispatchf_transfer20%
method

f_transfer(self, event)

Terminal0
class

Transparent channel that performs a callback when termination is received from the upstream channel.

Used as an at-exit callback for flows.

Terminal__init__0
method

__init__(self, endpoint)

Terminalf_terminate0
method

f_terminate(self)

Monitor0
class

Terminal measuring transfer throughput.

Monitoractuate60%
method

actuate(self)

Monitorf_transfer20%
method

f_transfer(self, event)

Monitortm_start10%
property

Monitortm_archive170%
method

tm_archive(self, pit)

Archive transfer data occurring before pit.

Monitortm_rate90%
method

tm_rate(self, window)

Relay0
class

Relay intersector transfers.

Initialized with the set of events that will be relayed, fe_transfer, fe_terminate, and fe_interrupt.

Relay__init__0
method

__init__(self, integral, key)

Relayf_transfer0
method

f_transfer(self, event)

Relayf_terminate0
method

f_terminate(self)

Relayinterrupt0
method

interrupt(self)

Receiver0
class

Receive intersector transfers.

A simple Channel expecting to receive events from a remote Relay

Receiverf_type0
data

f_type = 'source'

Receiver_r_connect
data

_r_connect = None

Receiver__init__0
method

__init__(self, connect)

Receiverf_transfer0
method

f_transfer(self, events)

Receiverint_transfer0
method

int_transfer(self, key, event)

Receiverint_terminate0
method

int_terminate(self, key)

Transformation0
class

A flow that performs a transformation on the received events.

Transformationf_type0
data

f_type = 'transformer'

Transformation__init__0
method

__init__(self, transform)

Transformationf_transfer0
method

f_transfer(self, event)

Iteration0
class

Channel that emits the contents of an collections.abc.Iterator until an obstruction occurs or the iterator ends.

Iterationf_type0
data

f_type = 'source'

Iterationf_clear0
method
bool

f_clear(self, *args)

Override of Channel.f_clear that enqueues an it_transition call if it's no longer obstructed.

Iterationit_transition0
method

it_transition(self)

Emit the next item in the iterator until an obstruction occurs or the iterator is exhausted.

Iteration__init__0
method

__init__(self, iterator)

Iteration__init__Parameters

self

Undocumented.

iterator

The iterator that produces events.

Iterationactuate0
method

actuate(self)

Iterationf_transfer20%
method

f_transfer(self, it)

Raises exception as Iteration is a source.

Collection0
class

Terminal Channel collecting the events into a buffer for processing after termination.

Collectionf_type0
data

f_type = 'terminal'

Collection__init__0
method

__init__(self, storage, operation)

Collectionappended_list0
classmethod

appended_list(Class)

Construct a Collection instance that appends all events into a list.

Collectionlist0
data

list = appended_list
	@classmethod

Collectionextended_list30%
classmethod

extended_list(Class)

Construct a Collection instance that extends all events into a list.

Collectiondict0
classmethod

dict(Class)

Construct a Collection instance that builds the contents of a mapping from sequences of key-value pairs.

Collectionset0
classmethod

set(Class)

Collection_buffer_operation0
staticmethod

_buffer_operation(event)

Collectionbuffer0
classmethod

buffer(Class)

Construct a Collection instance that accumulates data from sequences of data into a single bytearray.

Collectionf_transfer0
method

f_transfer(self, obj)

Parallel0
class

A dedicated thread for processing events emitted to the Flow.

The requisite function should have the following signature:

def thread_function(transformer, queue, *optional):
	...

The queue provides access to the events that were received by the Transformer, and the transformer argument allows the thread to cause obstructions by accessing its controller.

Parallel__init__40%
method

__init__(self, target, *parameters)

Parallelterminate40%
method

terminate(self)

Initiate termination of the thread.

Paralleltrap60%
method

trap(self)

Internal; Trap exceptions in order to map them to faults.

Parallelf_transfer20%
method

f_transfer(self, event)

Send the event to the queue that the Thread is connected to. Injections performed by the thread will be enqueued into the main task queue.

Parallelactuate20%
method

actuate(self)

Execute the dedicated thread for the transformer.

Protocol0
class

Protocol class for containing the state of a protocol layer.

Protocol__init__0
method

__init__(self, shared, local, transfer)

Protocolf_transfer0
method

f_transfer(self, event)

Protocolp_terminated20%
method

p_terminated(self)

Called when the internal protocol state has completed termination.

Defaults to Channel.f_terminate but overridden in cases where synchronization needs to occur with a corresponding Protocol channel.

Protocolp_drain0
method

p_drain(self)

Perform an empty transfer allowing any transmit buffers to be emptied.

Catenation0
class

Sequence a set of flows in the enqueued order.

Emulates parallel operation by facilitating the sequenced delivery of a sequence of flows where the first flow is carried until completion before the following flow may be processed.

Essentially, this is a buffer array that uses Flow termination signals to manage the current working flow and queues to buffer the events to be emitted when next is promoted.

CatenationEngineering

notes

Subjected to a number of adjustments, there may be a few reductions that can be performed without impacting functionality.

Untested
  • Recursive transition() calls.

CatenationProperties

cat_order

Queue of channels dictating the order of the flows.

cat_connections

Mapping of connected Flow instances to their corresponding queue, Layer, and termination state.

cat_flows

Channel identifier associated with weak reference to upstream.

Catenationf_type0
data

f_type = 'join'

Catenation__init__0
method

__init__(self)

Catenationcat_overflowing0
method

cat_overflowing(self, channel_id)

Whether the given flow's queue has too many items.

Catenationint_transfer191%
method

int_transfer(self, channel_id, events)

Emit point for Sequenced Flows

Catenationint_connect0
method

int_connect(self, channel_id, initiate, flow)

Connect the flow to the channel_id using the initiate parameter.

Catenationint_reserve0
method

int_reserve(self, *channel_id)

Reserve a position in the sequencing of the flows. The given initiate is the reference object used by int_connect in order to actually connect flows.

Catenationf_transfer187%
method

f_transfer(self, events)

Transparency support allowing Division to be directly connected. Usually unused.

Catenationint_terminate340%
method

int_terminate(self, channel_id)

Catenationf_terminate0
method

f_terminate(self)

Catenationterminate10%
method

terminate(self)

Termination signal ignored. Flow state dictates terminal state.

Catenationcat_flush0
method

cat_flush(self)

Flush the accumulated events downstream.

Catenationcat_drain193%
method

cat_drain(self)

Drain the new head of line emitting any queued events and updating its entry in cat_connections to immediately send events.

Catenationcat_transition191%
method

cat_transition(self)

Move the first enqueued flow to the front of the line; flush out the buffer and remove ourselves as an obstruction.

Division0
class

Coordination of the routing of a protocol's content.

Protocols consisting of a series of requests, HTTP for instance, need to control where the content of a request goes. QueueProtocolInput manages the connections to actual Flow instances that delivers the transformed application level events.

Divisionf_type0
data

f_type = 'fork'

Division__init__0
method

__init__(self, dispatch)

Divisionf_transfer0
method

f_transfer(self, events)

Direct the given events to their corresponding action in order to map protocol stream events to Flow instances.

Divisioninterrupt50%
method

interrupt(self)

Interruptions on distributions translates to termination.

Divisionf_terminate362%
method

f_terminate(self)

Divisiondiv_initiate0
method

div_initiate(self, f_event, channel_id, initiate)

Initiate a subflow using the given channel_id as its identity. The channel_id along with a callable performing div_connect will be emitted to the Flow.f_connect downstream.

Divisiondiv_connect1060%
method

div_connect(self, channel_id, flow)

Associate the flow with the channel_id allowing transfers into the flow.

Drains the queue that was collecting events associated with the channel_id, and feeds them into the flow before destroying the queue. Layer connections without queues are the head of the line, and actively receiving transfers and control events.

Divisiondiv_transfer180%
method

div_transfer(self, f_event, channel_id, subflow_transfer)

Enqueue or transfer the events to the flow associated with the channel_id context.

Divisiondiv_terminate283%
method

div_terminate(self, f_event, channel_id, terminal)

End of subflow.

Divisiondiv_operations0
data

div_operations = {
	fe_initiate: div_initiate,
	fe_terminate: div_terminate,
	fe_obstruct: None,
	fe_clear: None,
	fe_transfer: div_transfer,
}