Protocol

Definition of abstract protocol type.

This module defines the protocol type inherited by all protocol code implementations. Also defined is the stack protocol, which adds push and pop functionality.

class sequence.protocol.Protocol(owner: Node, name: str)

Abstract protocol class for code running on network nodes.

own

node protocol is attached to.

Type:

Node

name

label for protocol instance.

Type:

str

protocol_type

type of protocol instance (e.g. ‘single_heralded’).

Type:

str

abstractmethod received_message(src: str, msg: Message)

Receive classical message from another node.

class sequence.protocol.StackProtocol(owner: Node, name: str)

Abstract protocol class for protocols in a stack structure.

Adds interfaces for push and pop functions.

own

node protocol is attached to.

Type:

Node

name

label for protocol instance.

Type:

str

upper_protocols

Protocols to pop to.

Type:

list[StackProtocol]

lower_protocols

Protocols to push to.

Type:

list[StackProtocol]

abstractmethod pop(*args, **kwargs)

Method to receive information from protocols lower on stack (abstract).

abstractmethod push(*args, **kwargs)

Method to receive information from protocols higher on stack (abstract).

received_message(src: str, msg: Message)

Method to receive messages from distant nodes.