Documentation ¶
Index ¶
- Constants
- Variables
- func TopicToCid(topic *Topic) cid.Cid
- type PubsubManager
- func (g *PubsubManager) Broadcast(location common.Location, data interface{}) error
- func (g *PubsubManager) GetGenesis() common.Hash
- func (g *PubsubManager) PeersForTopic(t *Topic) ([]peer.ID, error)
- func (g *PubsubManager) SetQuaiBackend(consensus quai.ConsensusAPI)
- func (g *PubsubManager) SetReceiveHandler(receiveCb func(peer.ID, string, string, interface{}, common.Location))
- func (g *PubsubManager) Stop() error
- func (g *PubsubManager) Subscribe(topicSub *Topic, location common.Location, datatype interface{}) error
- func (g *PubsubManager) SubscribeAndRegisterValidator(location common.Location, datatype interface{}, ...) error
- func (g *PubsubManager) Unsubscribe(location common.Location, datatype interface{}) error
- func (g *PubsubManager) UnsubscribeAll()
- func (g *PubsubManager) ValidatorFunc() ...
- type Topic
Constants ¶
View Source
const ( // Data types for gossipsub topics C_workObjectType = "blocks" C_transactionType = "transactions" C_headerType = "headers" C_workObjectRequestDegree = 3 C_workObjectHeaderTypeRequestDegree = 3 C_defaultRequestDegree = 3 )
Variables ¶
Functions ¶
func TopicToCid ¶
func TopicToCid(topic *Topic) cid.Cid
Creates a Cid from a location to be used as DHT key
Types ¶
type PubsubManager ¶
func NewGossipSubManager ¶
creates a new gossipsub instance TODO: what options do we need for quai network? See: See https://pkg.go.dev/github.com/libp2p/go-libp2p-pubsub@v0.10.0#Option
func (*PubsubManager) Broadcast ¶
func (g *PubsubManager) Broadcast(location common.Location, data interface{}) error
broadcasts data to subscribing peers
func (*PubsubManager) GetGenesis ¶
func (g *PubsubManager) GetGenesis() common.Hash
func (*PubsubManager) PeersForTopic ¶
func (g *PubsubManager) PeersForTopic(t *Topic) ([]peer.ID, error)
lists our peers which provide the associated topic
func (*PubsubManager) SetQuaiBackend ¶
func (g *PubsubManager) SetQuaiBackend(consensus quai.ConsensusAPI)
func (*PubsubManager) SetReceiveHandler ¶
func (*PubsubManager) Stop ¶
func (g *PubsubManager) Stop() error
func (*PubsubManager) Subscribe ¶
func (g *PubsubManager) Subscribe(topicSub *Topic, location common.Location, datatype interface{}) error
subscribe to broadcasts of the given type of data
func (*PubsubManager) SubscribeAndRegisterValidator ¶ added in v0.32.0
func (g *PubsubManager) SubscribeAndRegisterValidator(location common.Location, datatype interface{}, validatorFunc pubsub.ValidatorEx) error
func (*PubsubManager) Unsubscribe ¶
func (g *PubsubManager) Unsubscribe(location common.Location, datatype interface{}) error
unsubscribe from broadcasts of the given type of data
func (*PubsubManager) UnsubscribeAll ¶
func (g *PubsubManager) UnsubscribeAll()
func (*PubsubManager) ValidatorFunc ¶ added in v0.32.0
func (g *PubsubManager) ValidatorFunc() func(ctx context.Context, id p2p.PeerID, msg *pubsub.Message) pubsub.ValidationResult
type Topic ¶
type Topic struct {
// contains filtered or unexported fields
}
func TopicFromString ¶
func (*Topic) GetLocation ¶
func (*Topic) GetRequestDegree ¶ added in v0.30.0
func (*Topic) GetTopicType ¶
func (t *Topic) GetTopicType() interface{}
Click to show internal directories.
Click to hide internal directories.