coordinator

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package coordinator provides types and methods for the coordination of Helium nodes. In the current implementation, it only provides the event types constituting the event log.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coordinator

type Coordinator interface {
	Incoming() <-chan Event
	Outgoing() chan<- Event
}

Coordinator defines the interface for a coordinator. A coordinator is a source of incoming events for the coordinated (downstream) component and a sink for outgoing events from the coordinated component.

type Event

type Event struct {
	ProtocolEvent *protocols.Event
	CircuitEvent  *circuits.Event // TODO refactor as setup and compute event wrapping protocol events ?
}

Event is a type for coordination events in the coordinator.

func (Event) IsComputeEvent

func (ev Event) IsComputeEvent() bool

IsComputeEvent returns whether the event contains a circuit-related event.

func (Event) IsProtocolEvent

func (ev Event) IsProtocolEvent() bool

IsProtocolEvent whether the event contains a protocol-related event.

func (Event) IsSetupEvent

func (ev Event) IsSetupEvent() bool

IsSetupEvent returns whether the event contains a protocol-related event.

func (Event) String

func (ev Event) String() string

String returns a string representation of the event.

type Log

type Log []Event

Log is a type for a coordinator log. A coordinator log is an ordered list of events.

type TestCoordinator

type TestCoordinator struct {
	// contains filtered or unexported fields
}

TestCoordinator is a test implementation of a centralized coordinator that broadcasts its events to all its clients.

func NewTestCoordinator

func NewTestCoordinator() *TestCoordinator

NewTestCoordinator creates a new test coordinator.

func (*TestCoordinator) Close

func (tc *TestCoordinator) Close()

Close closes the coordination log.

func (*TestCoordinator) Incoming

func (tc *TestCoordinator) Incoming() <-chan Event

Incoming returns the incoming event channel.

func (*TestCoordinator) LogEvent

func (tc *TestCoordinator) LogEvent(ev Event)

LogEvent appends a new event to the coordination log.

func (*TestCoordinator) NewPeerCoordinator

func (tc *TestCoordinator) NewPeerCoordinator(nid helium.NodeID) *TestCoordinator

NewPeerCoordinator creates a new node coordinator.

func (*TestCoordinator) Outgoing

func (tc *TestCoordinator) Outgoing() chan<- Event

Outgoing returns the outgoing event channel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL