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 ¶
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 ¶
IsComputeEvent returns whether the event contains a circuit-related event.
func (Event) IsProtocolEvent ¶
IsProtocolEvent whether the event contains a protocol-related event.
func (Event) IsSetupEvent ¶
IsSetupEvent returns whether the event contains a protocol-related 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.