Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrStopped = fmt.Errorf("stopped at caller request")
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct { ID t.NodeID // Protocol-level node ID Config *NodeConfig // Node-level (protocol-independent) configuration, like buffer sizes, logging, ... // contains filtered or unexported fields }
Node is the local instance of Mir and the application's interface to the mir library.
func NewNode ¶
func NewNode( id t.NodeID, config *NodeConfig, m modules.Modules, interceptor eventlog.Interceptor, ) (*Node, error)
NewNode creates a new node with ID id. The config parameter specifies Node-level (protocol-independent) configuration, like buffer sizes, logging, ... The modules parameter must contain initialized, ready-to-use modules that the new Node will use.
func (*Node) Debug ¶
Debug runs the Node in debug mode. The Node will ony process events submitted through the Step method. All internally generated events will be ignored and, if the eventsOut argument is not nil, written to eventsOut instead. Note that if the caller supplies such a channel, the caller is expected to read from it. Otherwise, the Node's execution might block while writing to the channel.
func (*Node) InjectEvents ¶
InjectEvents inserts a list of Events in the Node.
func (*Node) Run ¶
Run starts the Node. It first adds an Init event to the work items, giving the modules the possibility to perform any initialization. Run then launches the processing of incoming messages, and internal events. The node stops when the ctx is canceled. The function call is blocking and only returns when the node stops.
type NodeConfig ¶
type NodeConfig struct { // Logger provides the logging functions. Logger logging.Logger // MaxEventBatchSize is the maximum number of events that can be dispatched to a module in a single batch. MaxEventBatchSize int // PauseInputThreshold is the number of events in the node's internal event buffer that triggers the disabling // of further external input (i.e. events emitted by active modules). Events emitted by passive modules are // not affected. The processing of external events is resumed when the number of events in the buffer drops // below the ResumeInputThreshold. PauseInputThreshold int // ResumeInputThreshold is the number of events in the node's internal event buffer that triggers the enabling // of external input (i.e. events emitted by active modules). Events emitted by passive modules are not affected. // When the external input is disabled and the number of events in the buffer drops below ResumeInputThreshold, // external input events can be added to the event buffer again. ResumeInputThreshold int // If not zero, the Node will emit a log entry (level Debug) every StatsLogInterval // containing statistics about event processing. StatsLogInterval time.Duration }
The NodeConfig struct represents configuration parameters of the node that are independent of the protocol the Node is executing. NodeConfig only contains protocol-independent parameters. Protocol-specific parameters should be specified when instantiating the protocol implementation as one of the Node's modules.
func DefaultNodeConfig ¶
func DefaultNodeConfig() *NodeConfig
DefaultNodeConfig returns the default node configuration. It can be used as a base for creating more specific configurations when instantiating a Node.
func (*NodeConfig) Validate ¶
func (c *NodeConfig) Validate() error
func (*NodeConfig) WithLogger ¶
func (c *NodeConfig) WithLogger(logger logging.Logger) *NodeConfig
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
mircat
Handles the processing, display and retrieval of events from a given eventlog file
|
Handles the processing, display and retrieval of events from a given eventlog file |
pkg
|
|
crypto
Package crypto provides an implementation of the MirModule module.
|
Package crypto provides an implementation of the MirModule module. |
iss
Package iss contains the implementation of the ISS protocol, the new generation of Mir.
|
Package iss contains the implementation of the ISS protocol, the new generation of Mir. |
messagebuffer
Package messagebuffer implements a backlog for messages that have been received but cannot yet be processed.
|
Package messagebuffer implements a backlog for messages that have been received but cannot yet be processed. |
modules
Package modules provides interfaces of modules that serve as building blocks of a Node.
|
Package modules provides interfaces of modules that serve as building blocks of a Node. |
modules/mockmodules/internal/mock_internal
Package mock_internal is a generated GoMock package.
|
Package mock_internal is a generated GoMock package. |
testsim
Package testsim implements a deterministic execution runtime driven by simulated logical time.
|
Package testsim implements a deterministic execution runtime driven by simulated logical time. |
threshcrypto
Package threshcrypto provides an implementation of the MirModule module.
|
Package threshcrypto provides an implementation of the MirModule module. |
samples
|
|