core11366%python.module
fault.kernel

Core data types and classes.

typing
import

functools0
import

builtins0
import

operator0
import

weakref0
import

collections0
import

itertools0
import

traceback0
import

heapq0
import

weak0
import

set_actuated0
function

set_actuated(processor)

set_terminated20%
function

set_terminated(processor)

Join0
class

An object whose purpose is to join the completion of multiple processors into a single event. Joins are used to simplify coroutines whose progression depends on a set of processors instead of one.

Joins also enable interrupts to trigger completion events so that failures from unrelated Sectors can be communicated to callback.

JoinProperties

dependencies

The original set of processors as a dictionary mapping given names to the corresponding Processor.

pending

The current state of pending exits that must occur prior to the join-operation's completion.

callback

The callable that is performed after the pending set has been emptied; defined by atexit.

Join__slots__0
data

__slots__ = ('dependencies', 'pending', 'callback')

Join__init__0
method

__init__(self, **processors)

Initialize the join with the given processor set.

Joinconnect0
method

connect(self)

Connect the Processor.atexit calls of the configured dependencies to the Join instance.

Join__iter__0
method

__iter__(self)

Return an iterator to the configured dependencies.

Join__getitem__0
method

__getitem__(self, k)

Get the dependency the given identifier.

Joinexited0
method

exited(self, processor)

Record the exit of the given processor and execute the callback of the Join if the processor is the last in the configured pending set.

Joinatexit0
method

atexit(self, callback)

Assign the callback of the Join.

If the pending set is empty, the callback will be immediately executed, otherwise, overwrite the currently configured callback.

The callback is executed with the Join instance as its sole parameter.

JoinatexitParameters

self

Undocumented.

callback

The task to perform when all the dependencies have exited.

Condition0
class

A reference to a logical expression or logical function.

Conditional references are constructed from a subject object, attribute path, and parameters. Used to clearly describe the objects that participate in a logical conclusion of interest.

Used by Flow instances to describe the condition in which an obstruction is removed. Conditions provide introspecting utilities the capacity to identify the cause of an obstruction.

Condition__slots__0
data

__slots__ = ('focus', 'path', 'parameter')

Condition__init__0
method

__init__(self, focus, path, parameter)

Condition__init__Parameters

self

Undocumented.

focus

The root object that is safe to reference

path

The sequence of attributes to resolve relative to the focus.

parameter

Determines the condition is a method and should be given this as its sole parameter. None indicates that the condition is a property.

Condition__bool__0
method

__bool__(self)

Condition__repr__50%
method

__repr__(self)

Conditionattribute0
method

attribute(self)

Inexorable0
data

Inexorable = Condition(builtins, ('False',))

ExceptionStructure0
class

Exception associated with an interface supporting the sequencing of processor trees.

ExceptionStructureactuated
data

actuated=True

ExceptionStructureterminated
data

terminated=False

ExceptionStructureinterrupted
data

interrupted=False

ExceptionStructure__init__20%
method

__init__(self, identity, exception)

ExceptionStructure__getitem__10%
method

__getitem__(self, k)

ExceptionStructurestructure50%
method

structure(self)

Processor0
class

A resource that maintains an arbitrary state.

State Transition Sequence.

  1. Instantiated

  2. Actuated

  3. Functioning

  4. Terminating

  5. Terminated

Where the functioning state designates that the implementation specific state has been engaged. Often, actuation and termination intersect with implementation states.

The interrupted state is special; its used as a frozen state of the machine and is normally associated with an exception. The term interrupt is used as it is nearly analogous with UNIX process interrupts SIGINT.

Processor_unset_sector
method

_unset_sector(self)

Processor_sector_reference0
data

_sector_reference = _unset_sector

Processor_invert_sector_reference20%
method

_invert_sector_reference(self)

Processor_dereference_sector0
method

_dereference_sector(self)

Processor_set_sector_reference0
method

_set_sector_reference(self, obj)

Processorsector0
data

sector = controller = property(
	fget = _dereference_sector,
	fset = _set_sector_reference,
	doc = "The managing processor."
)

Processorcontrollerstack70%
method

controllerstack(self)

Return the full sector stacks of the processor.

Processor__repr__40%
method

__repr__(self)

Processor_pexe_state
data

_pexe_state = 0 # defaults to "object initialized"

Processor_pexe_states0
data

_pexe_states = (
	('initialized', 0), # Created.
	('actuated', 1), # Placed in Execution Context and started.
	('terminating', 2), # Received and accepted termination request.
	('terminated', -1), # Termination completed and the processor will exit().
	('deallocating', 0), # Unused state.
)

Processor_pexe_contexts0
data

_pexe_contexts = ()
	@property

Processoractuated233%
property
bool

Whether the processor has been actuated, normally within a Sector.

Processorterminating0
property
bool

Whether the processor has started terminate.

Processorterminated0
property
bool

Whether the processor has been terminated.

Processorstatus10%
property

Processorinterrupted0
property
typing.Union[bool]

Processorexceptions
data

exceptions = None
	@property

Processorfunctioning0
property

Whether or not the Processor is functioning. Indicates that the processor was actuated and is neither terminated nor interrupted.

NOTE

Processors are functioning during termination; instances where Processor.terminating == True. Termination may cause limited access to functionality, but are still considered functional.

Processoractuate0
method

actuate(self)

Initialize the Processor for use within the controlling Sector.

Initialization method called after a Processor has been given execution context. Processor.actuate performs no actions and does not need to be called when overridden.

Processorstart_termination
method

start_termination(self)

Processorfinish_termination0
method

finish_termination(self)

Processorterminate0
method

terminate(self)

Terminate the Processor using interrupt and exit.

Processorinterrupt0
method

interrupt(self)

Signal the Processor that the controlling Sector has been interrupted, and all processing of events should cease immediately.

Subclasses that need to perform disconnects or cancellations should implement this method in order to ensure that event processing stops. However, interrupt procedures will automatically rewrite the process method to perform a no-op if invoked, so carefully written subclasses may not have to perform any tasks at all.

Processorfault0
method

fault(self, exception)

Note the given exception as an error on the Processor. Exceptions identified as errors cause the Processor to exit.

Called internally when a task associated with a Processor raises an exception. The controlling Sector will be interrupted and the faulting Processor identified for subsequent scrutiny.

Processortrap0
method

trap(self, task)

Processorcritical0
method

critical(self, task)

Enqueue a task associated with the sector so that exceptions cause the sector to fault. This is the appropriate way for Processor instances controlled by a sector to sequence processing.

Processorexit0
method

exit(self)

Exit the processor by signalling the controlling processor that termination has completed.

Processorstructure70%
method

structure(self)

Provides the structure stack with at-exit callbacks.

Processorplacement0
method

placement(self)

Define the set index to use when dispatched by a Sector.

By default, Sector instances place Processor instances into set objects that stored inside a dictionary. The index used for placement is allowed to be overridden in order to optimize the groups and allow better runtime introspection.

Processorsubstitute20%
method

substitute(self, processor)

Terminate the processor self, but reassign the exit hooks to be performed when the given processor exits. processor will be dispatched into the controlling sector.

Sector0
class

A processing sector; manages a set of Processor resources according to their class. Termination of a Sector is solely dependent whether or not there are any Processor instances within the Sector.

Sectors are the primary Processor class and have protocols for managing projections of entities (users) and their authorizing credentials.

SectorProperties

processors

A divided set of abstract processors currently running within a sector. The sets are divided by their type inside a collections.defaultdict.

exits

Set of Processors that are currently exiting. None if nothing is currently exiting.

Sectorexits
data

exits = None

Sectorprocessors
data

processors = None

Sector_sector_interrupted
data

_sector_interrupted = False
	@property

Sectorinterrupted0
property

Sectoriterprocessors0
method

iterprocessors(self)

Sectorstructure30%
method

structure(self)

Sector__init__0
method

__init__(self, *processors)

Sectoractuate280%
method

actuate(self)

Actuate the Sector by actuating its processors. There is no guarantee to the order in which the controlled processors are actuated.

Exceptions that occur during actuation fault the Sector causing the controlling sector to exit. If faults should not cause the parent to be interrupted, they must be dispatched after self has been actuated.

Sector_sector_terminated0
data

_sector_terminated = Processor.exit

Sectorterminate60%
method

terminate(self)

Sectorinterrupt185%
method

interrupt(self)

Interrupt the Sector by interrupting all of the subprocessors. The order of interruption is random, and should be insignificant.

Sectorexited271%
method

exited(self, processor)

Sector structure exit handler.

Called when a Processor has reached termination and should no longer be contained within the Sector.

Sectordispatch0
method

dispatch(self, processor)

Dispatch the given processor inside the Sector.

Returns the given processor.

Sector_flow60%
method

_flow(self, series)

Sectorreap0
method

reap(self)

Empty the exit set and check for sector completion.

Sectorreaped0
method

reaped(self)

Called once the set of exited processors has been reaped in order to identify if the Sector should notify the controlling Sector of an exit event..

Sectorplacement40%
method

placement(self)

Use Interface.if_sector_placement if the sector has an Interface. Otherwise, Sector.

Context0
class

The base class for Transaction Context processors.

Subclasses define the initialization process of a Transaction and the structures used to provide depending processors with the necessary information for performing their tasks.

ContextNamespaces

Context Processors employ two hard namespaces in its methods. The xact_ctx_ and the xact_. Methods and properties that exist under xact_ctx_ refer to generic Context operations whereas xact_ refers to operations that primary effect the Transaction sector containing the context.

Contextplacement0
method

placement(self)

Contextrequire10%
method

require(self, identifier)

Contextprovide0
method

provide(self, identifier)

Export self as a named context inherited by all descending processors.

Contextxact_empty0
method
bool

xact_empty(self)

Whether the Transaction has any processors aside from the Context.

Contextxact_exit_if_empty0
method

xact_exit_if_empty(self)

Check for processors other than self, if there are none, exit the transaction.

Contextxact_contextstack712%
method
typing.Iterable[Processor]

xact_contextstack(self)

The complete context stack of the Transaction excluding self. First entry is nearest to self; last is furthest ascent.

Contextxact_subxacts10%
property

Contextxact_dispatch0
method

xact_dispatch(self, processor)

Dispatch the given processor into the Transaction.

Contextxact_initialized20%
method

xact_initialized(self)

Called when the Transaction Context has been fully initialized with respect to the proposed event set determined by actuation.

Contextxact_exit0
method

xact_exit(self, xact)

Subtransaction xact exited.

Contextxact_void20%
method

xact_void(self, xact)

All subtransactions exited; xact was final. Defaults to termination of the context and transaction exit.

Contextinterrupt0
method

interrupt(self)

Update Transaction Context callbacks to null operations.

Sets interrupted to True and should be called by subclasses if overridden.

Transaction0
class

A Sector with Execution Context.

Transactions are sectors with a single Context instance that is used to manage the state of the Sector. Regular Sectors exit when all the processors are shutdown, and Transactions do too. However, the Context is the controlling processor and must be the last to exit.

TransactionProperties

xact_context

The Processor that will be dispatched to initialize the Transaction Sector and control its effect. Also, the receiver of Processor.terminate.

Transactioncreate0
classmethod

create(Class, xc)

Create a Transaction sector with the given Context initializaed as the first Processor to be actuated.

This is the appropriate way to instantiate Transaction instances

Transactionisinstance20%
method

isinstance(self, ContextClass)

Whether the Transaction's context, xact_context, is an instance of the given ContextClass.

Transactionterminate0
method

terminate(self)

Invoke the Context.terminate method of the xact_context property. The termination of the Transaction is managed entirely by the Context.

Transactionplacement0
method

placement(self)

Define the set index to use when dispatched by a Sector.

By default, Sector instances place Processor instances into set objects that stored inside a dictionary. The index used for placement is allowed to be overridden in order to optimize the groups and allow better runtime introspection.

Transactionsubtransactions0
property

The set of subtransactions currently running.

Transactioniterprocesses20%
method

iterprocesses()

Transactionexited0
method

exited(self, processor)

Executable0
class

Transaction sequence created from an invocation.

ExecutableProperties

exe_identifier

A, usually, unique identifier for the executable. The transaction context that the executable is dispatched within determines any constraints, if any.

exe_invocation

The primary set of parameters used by the executable.

exe_faults

The set of sectors that were faulted within the context; usually keyed by the identifier of the processor that was blamed.

exe_faults_count

The total number of faults that occurred. In cases where faults have been purged from exe_faults, the count allows recognition of the purge.

exe_queue

The transactions to be executed in order to complete execution.

Executable__init__183%
method

__init__(self, invocation)

Executableactuate0
method

actuate(self)

Executableterminate50%
method

terminate(self)

Executablexact_void183%
method

xact_void(self, final)

Consume the next transaction in the queue.

Executableexe_enqueue0
method

exe_enqueue(self, xact_context)

Executableexe_initialize0
method

exe_initialize(self)

Execute the enqueued transaction or cause the executable to exit.

Executablefaulted80%
method
None

faulted(self, proc)

Place the sector into the faults directory using the hex identifier as its name.

Executablestructure20%
method

structure(self)

Sequenced0
class

Transaction sequence created from a predefined sequence of Context instances.

Subtransactions are dispatched in order and terminated in reverse order.

Sequenced__init__10%
method

__init__(self, contexts)

Sequencedactuate30%
method

actuate(self)

Sequencedxact_exit70%
method

xact_exit(self, xact)

Sequencedxact_void10%
method

xact_void(self, final)

Sequencedterminate30%
method

terminate(self)