pydistsim.demo_algorithms.broadcast.Flood

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

Bases: NodeAlgorithm

Methods

__init__

add_observers

alarm

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

default_DONE

Do nothing, for all inputs.

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_IDLE

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_INITIATOR

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.

S_init = (Status.INITIATOR, Status.IDLE)

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

S_term = (Status.DONE,)

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

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.

algorithm_restrictions = (<class 'pydistsim.restrictions.communication.BidirectionalLinks'>, <class 'pydistsim.restrictions.reliability.TotalReliability'>, <class 'pydistsim.restrictions.topological.Connectivity'>, <class 'pydistsim.restrictions.topological.UniqueInitiator'>)

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

default_DONE(*args, **kwargs)

Do nothing, for all inputs.

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.