pydistsim.tests.test_inbox_blocking.TimerAlgorithm

class TimerAlgorithm(*args, **kwargs)[source]

Bases: NodeAlgorithm

Methods

__init__

add_observers

alarm

alarm_BLOCKER

apply_restrictions

Apply all applicable restrictions.

block_inbox

Block the inbox of a node, so that only messages that satisfy the filter can be processed.

check_algorithm_initialization

Check if the algorithm's current state matches the expected initial state.

check_algorithm_termination

Check if the algorithm's current state matches the expected termination state.

check_restrictions

Check if the restrictions are satisfied.

clear_observers

close

Close the inbox of the node for a specific neighbor.

default

disable_alarm

Disable an alarm.

disable_all_node_alarms

Disable all alarms set for the node.

initializer

Method used to initialize the algorithm.

is_halted

Check if the distributed algorithm has come to an end or deadlock, i.e. there are no messages to pass and no alarms set.

is_initialized

notify_observers

open

Open the inbox of the node for a specific neighbor.

receiving

receiving_BLOCKER

reset

Reset the algorithm to its initial state.

send

Send content to destination, with header.

send_msg

Send a message to nodes listed in message's destination field.

set_alarm

Set an alarm for the node.

spontaneously

spontaneously_BLOCKER

spontaneously_OTHER

step

unblock_inbox

Unblock the inbox of a node, so that all messages can be processed.

update_alarm_time

Update the time of an alarm by adding a time difference.

Attributes

INI

S_init

Tuple of statuses that nodes should have at the beginning of the algorithm.

S_term

Tuple of statuses that nodes should have at the end of the algorithm.

algorithm_restrictions

Tuple of restrictions that must be satisfied for the algorithm to run.

default_params

network

required_params

nwm

Node wrapper manager.

class Status(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StatusValues

__new__(value)
_generate_next_value_(start, count, last_values)

Return the lower-cased version of the member name.

_alarms: list[Alarm]

List of alarms set for the nodes.

initializer()[source]

Method used to initialize the algorithm. Is always called first. NodeAlgorithm subclasses may want to reimplement it.

Base implementation sends an INI message to the node with the lowest id and applies all restrictions.