Documentation ¶
Overview ¶
Package events defines events published by go-spacemsh node using nodes pubsub
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeEventPubsub ¶
func InitializeEventPubsub(ur string)
InitializeEventPubsub initializes the global pubsub broadcaster server
Types ¶
type AtxCreated ¶
AtxCreated signals this miner has created an activation transaction
func (AtxCreated) GetChannel ¶
func (AtxCreated) GetChannel() ChannelID
GetChannel gets the message type which means on which this message should be sent
type ChannelID ¶ added in v0.1.11
type ChannelID byte
ChannelID is the ID on which subscribers must register in order to listen to messages on the channel.
type DoneCreatingBlock ¶
DoneCreatingBlock signals that this miner has created a block
func (DoneCreatingBlock) GetChannel ¶
func (DoneCreatingBlock) GetChannel() ChannelID
GetChannel gets the message type which means on which this message should be sent
type Event ¶
type Event interface { // GetChannel returns the channel on which this message will be published. GetChannel() ChannelID }
Event defines the interface that each message sent by the EventPublisher needs to implemet for it to correctly be routed by topic.
type EventPublisher ¶
type EventPublisher struct {
*Publisher
}
EventPublisher is the struct that publishes events to subscribers by topics.
func NewEventPublisher ¶
func NewEventPublisher(eventURL string) (*EventPublisher, error)
NewEventPublisher is a constructor for the event publisher, it received a url string in format of tcp://localhost:56565 to start listening for connections.
func (*EventPublisher) Close ¶
func (p *EventPublisher) Close() error
Close closes the published internal socket
func (*EventPublisher) PublishEvent ¶
func (p *EventPublisher) PublishEvent(event Event) error
PublishEvent publishes the provided event on pubsub infra. It encodes messages using XDR protocol.
type NewAtx ¶
NewAtx signals that a new ATX has been received
func (NewAtx) GetChannel ¶
GetChannel gets the message type which means on which this message should be sent
type NewBlock ¶
NewBlock is sent when a new block is created by this miner
func (NewBlock) GetChannel ¶
GetChannel gets the message type which means on which this message should be sent
type NewTx ¶
NewTx signals that a new transaction has been received and not yet validated
func (NewTx) GetChannel ¶
GetChannel gets the message type which means on which this message should be sent
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher is a wrapper for mangos pubsub publisher socket
type RewardReceived ¶
RewardReceived signals reward has been received
func (RewardReceived) GetChannel ¶
func (RewardReceived) GetChannel() ChannelID
GetChannel gets the message type which means on which this message should be sent
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
Subscriber defines the struct of the receiving end of the pubsub messages.
func NewSubscriber ¶
func NewSubscriber(url string) (*Subscriber, error)
NewSubscriber received url string as input on which it will register to receive messages passed by server.
func (*Subscriber) Close ¶
func (sub *Subscriber) Close() error
Close closes the socket which in turn will Close the listener func
func (*Subscriber) StartListening ¶
func (sub *Subscriber) StartListening()
StartListening runs in a go routine and listens to all channels this subscriber is registered to. it then passes the messages received to the appropriate reader channel.
func (*Subscriber) Subscribe ¶
func (sub *Subscriber) Subscribe(topic ChannelID) (chan []byte, error)
Subscribe subscribes to the given topic, returns a channel on which data from the topic is received.
func (*Subscriber) SubscribeToAll ¶
func (sub *Subscriber) SubscribeToAll() (chan []byte, error)
SubscribeToAll subscribes to all available topics.
type ValidAtx ¶
ValidAtx signals that an activation transaction with id ID has been validated
func (ValidAtx) GetChannel ¶
GetChannel gets the message type which means on which this message should be sent
type ValidBlock ¶
ValidBlock signals that block with id ID has been validated
func (ValidBlock) GetChannel ¶
func (ValidBlock) GetChannel() ChannelID
GetChannel gets the message type which means on which this message should be sent