Documentation
¶
Index ¶
- func PublishAndSubscribe[T any](ev Event, p EventPublisher, s EventSubscriber) (chan (T), error)
- func PublishAndSubscribeFirst[T any](ev Event, p EventPublisher, s EventSubscriber) (T, error)
- type BaseEvent
- type BaseEventOutput
- type CloseSubscription
- type DisconnectNodeEvent
- type DisconnectNodeEventOutput
- type Event
- type EventOutput
- type EventPublisher
- type EventStream
- type EventSubscriber
- type KillNodeProcessEvent
- type KillNodeProcessEventOutput
- type NodeSpeedtestEventOutput
- type QueryNodeConnectionsEvent
- type QueryNodeConnectionsEventOutput
- type QueryNodePackagesEvent
- type QueryNodePackagesEventOutput
- type QueryNodeProcessesEvent
- type QueryNodeProcessesEventOutput
- type StartNodeSpeedtestEvent
- type ZeroMQEventPubSub
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PublishAndSubscribe ¶
func PublishAndSubscribe[T any](ev Event, p EventPublisher, s EventSubscriber) (chan (T), error)
func PublishAndSubscribeFirst ¶
func PublishAndSubscribeFirst[T any](ev Event, p EventPublisher, s EventSubscriber) (T, error)
Publishes an event in a channel using [p], subscribes it's first value using [s], and closes before finishing.
Types ¶
type BaseEvent ¶
type BaseEvent struct { Event // contains filtered or unexported fields }
Projects an abstract class that implements the Event Interface.
type BaseEventOutput ¶
type BaseEventOutput struct { EventOutput // contains filtered or unexported fields }
func (BaseEventOutput) Error ¶
func (o BaseEventOutput) Error() error
func (BaseEventOutput) Origin ¶
func (o BaseEventOutput) Origin() Event
type CloseSubscription ¶
type CloseSubscription func()
type DisconnectNodeEvent ¶
func NewDisconnectNodeEvent ¶
func NewDisconnectNodeEvent( nodeID string, ) DisconnectNodeEvent
type DisconnectNodeEventOutput ¶
type DisconnectNodeEventOutput struct {
EventOutput
}
func NewDisconnectNodeEventOutput ¶
func NewDisconnectNodeEventOutput( origin Event, err error, ) DisconnectNodeEventOutput
type Event ¶
type Event interface {
ID() string
}
An event is a message that is published under a channel, which one or more clients can subscribe to.
func NewBaseEvent ¶
type EventOutput ¶
Represents the output of an event.
func NewBaseEventOutput ¶
func NewBaseEventOutput( origin Event, err error, ) EventOutput
type EventPublisher ¶
type EventPublisher interface { EventStream Publish(Event) error }
An interface for marking clients that can publish events to a channel.
type EventStream ¶
type EventStream interface { // If any, returns the public key used by publishers to authenticate // events. PublicKey() ([]byte, error) // Returns the address that the event stream is open on. Address() models.Address }
Represents metadata of an event stream.
type EventSubscriber ¶
type EventSubscriber interface { EventStream Subscribe(Event) (chan (EventOutput), CloseSubscription) }
An interface for marking clients that can subscribe the output of events from a channel.
type KillNodeProcessEvent ¶
func NewKillNodeProcessEvent ¶
func NewKillNodeProcessEvent( nodeID string, pid int32, ) KillNodeProcessEvent
type KillNodeProcessEventOutput ¶
type KillNodeProcessEventOutput struct {
EventOutput
}
func NewKillNodeProcessEventOutput ¶
func NewKillNodeProcessEventOutput( origin Event, err error, ) KillNodeProcessEventOutput
type NodeSpeedtestEventOutput ¶
type NodeSpeedtestEventOutput struct { EventOutput Speedtest models.Speedtest }
func NewNodeSpeedtestEventOutput ¶
func NewNodeSpeedtestEventOutput( origin Event, speedtest models.Speedtest, err error, ) NodeSpeedtestEventOutput
type QueryNodeConnectionsEvent ¶
func NewQueryNodeConnectionsEvent ¶
func NewQueryNodeConnectionsEvent( nodeID string, ) QueryNodeConnectionsEvent
type QueryNodeConnectionsEventOutput ¶
type QueryNodeConnectionsEventOutput struct { EventOutput Connections []models.Connection }
func NewQueryNodeConnectionsEventOutput ¶
func NewQueryNodeConnectionsEventOutput( origin Event, connections []models.Connection, err error, ) QueryNodeConnectionsEventOutput
type QueryNodePackagesEvent ¶
func NewQueryNodePackagesEvent ¶
func NewQueryNodePackagesEvent( nodeID string, ) QueryNodePackagesEvent
type QueryNodePackagesEventOutput ¶
type QueryNodePackagesEventOutput struct { EventOutput Packages []models.Package }
func NewQueryNodePackagesEventOutput ¶
func NewQueryNodePackagesEventOutput( origin Event, packages []models.Package, err error, ) QueryNodePackagesEventOutput
type QueryNodeProcessesEvent ¶
func NewQueryNodeProcessesEvent ¶
func NewQueryNodeProcessesEvent( nodeID string, ) QueryNodeProcessesEvent
type QueryNodeProcessesEventOutput ¶
type QueryNodeProcessesEventOutput struct { EventOutput Processes []models.Process }
func NewQueryNodeProcessesEventOutput ¶
func NewQueryNodeProcessesEventOutput( origin Event, processes []models.Process, err error, ) QueryNodeProcessesEventOutput
type StartNodeSpeedtestEvent ¶
func NewStartNodeSpeedtestEvent ¶
func NewStartNodeSpeedtestEvent( nodeID string, ) StartNodeSpeedtestEvent
type ZeroMQEventPubSub ¶
func NewZeroMQEventPubSub ¶
func NewZeroMQEventPubSub( socket *mq.Socket, ) ZeroMQEventPubSub
func (ZeroMQEventPubSub) Address ¶
func (p ZeroMQEventPubSub) Address() models.Address
func (ZeroMQEventPubSub) PublicKey ¶
func (p ZeroMQEventPubSub) PublicKey() ([]byte, error)
func (ZeroMQEventPubSub) Publish ¶
func (p ZeroMQEventPubSub) Publish(e Event) error
func (ZeroMQEventPubSub) Subscribe ¶
func (p ZeroMQEventPubSub) Subscribe(e Event) (chan (EventOutput), CloseSubscription)
Click to show internal directories.
Click to hide internal directories.