Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotReady = errors.New("tx gossiper is not ready")
Functions ¶
This section is empty.
Types ¶
type GossipMessage ¶
GossipMessage represents message gossiped via P2P network (e.g. transaction, Block etc).
type GossipValidator ¶
type GossipValidator func(*GossipMessage) bool
GossipValidator is a callback function type.
type Gossiper ¶
type Gossiper struct {
// contains filtered or unexported fields
}
Gossiper is an abstraction of P2P publish subscribe mechanism.
func NewGossiper ¶
func NewGossiper(host host.Host, ps *pubsub.PubSub, topicStr string, logger log.Logger, options ...GossiperOption) (*Gossiper, error)
NewGossiper creates new, ready to use instance of Gossiper.
Returned Gossiper object can be used for sending (Publishing) and receiving messages in topic identified by topicStr.
func (*Gossiper) Close ¶
Close is used to disconnect from topic and free resources used by Gossiper.
func (*Gossiper) ProcessMessages ¶
ProcessMessages waits for messages published in the topic and execute handler.
type GossiperOption ¶
GossiperOption sets optional parameters of Gossiper.
func WithValidator ¶
func WithValidator(validator GossipValidator) GossiperOption
WithValidator options registers topic validator for Gossiper.
Click to show internal directories.
Click to hide internal directories.