Documentation ¶
Index ¶
Constants ¶
View Source
const NEW_BLOCKS_TOPIC = "NEW_BLOCKS_TOPIC"
View Source
const PENDING_TX_TOPIC = "PENDING_TX_TOPIC"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MessageHandler ¶
type MessageTransport ¶
type MessageTransport struct {
Data []byte
}
type PubSubWrapper ¶
type PubSubWrapper struct { // A channel of signed transactions to send new pending transactions to peers Data chan MessageTransport TopicName string Context context.Context PubSub *pubsub.PubSub Topic *pubsub.Topic Sub *pubsub.Subscription Self peer.ID }
PubSubWrapper represents a subscription to a single PubSub topic. Messages can be published to the topic with PubSubWrapper.Publish, and received messages are pushed to the Messages channel. TODO this name is bad... but works for now..
func (*PubSubWrapper) Publish ¶
func (cr *PubSubWrapper) Publish(ctx context.Context, msgChan chan MessageTransport) error
Publish sends a message to the pubsub topic.
func (*PubSubWrapper) ReadLoop ¶
func (cr *PubSubWrapper) ReadLoop(ctx context.Context, onMessage MessageHandler)
readLoop pulls messages from the pubsub topic and pushes them onto the Messages channel.
type PublishHandler ¶
type PublishHandler func(msg []byte)
Click to show internal directories.
Click to hide internal directories.