Documentation
¶
Index ¶
- Constants
- func WithValidator(validate Validator) func(*Subscription) error
- func WithValidatorTimeout(timeout time.Duration) func(*Subscription) error
- type Message
- type Option
- type PubSub
- func (p *PubSub) GetTopics() []string
- func (p *PubSub) ListPeers(topic string) []peer.ID
- func (p *PubSub) Publish(topic string, data []byte) error
- func (p *PubSub) Subscribe(topic string, opts ...SubOpt) (*Subscription, error)
- func (p *PubSub) SubscribeByTopicDescriptor(td *pb.TopicDescriptor, opts ...SubOpt) (*Subscription, error)
- type PubSubNotif
- func (p *PubSubNotif) ClosedStream(n inet.Network, s inet.Stream)
- func (p *PubSubNotif) Connected(n inet.Network, c inet.Conn)
- func (p *PubSubNotif) Disconnected(n inet.Network, c inet.Conn)
- func (p *PubSubNotif) Listen(n inet.Network, _ ma.Multiaddr)
- func (p *PubSubNotif) ListenClose(n inet.Network, _ ma.Multiaddr)
- func (p *PubSubNotif) OpenedStream(n inet.Network, s inet.Stream)
- type RPC
- type SubOpt
- type Subscription
- type Validator
Constants ¶
View Source
const (
ID = protocol.ID("/floodsub/1.0.0")
)
Variables ¶
This section is empty.
Functions ¶
func WithValidator ¶
func WithValidator(validate Validator) func(*Subscription) error
WithValidator is an option that can be supplied to Subscribe. The argument is a function that returns whether or not a given message should be propagated further.
func WithValidatorTimeout ¶
func WithValidatorTimeout(timeout time.Duration) func(*Subscription) error
WithValidatorTimeout is an option that can be supplied to Subscribe. The argument is a duration after which long-running validators are canceled.
Types ¶
type Option ¶
func WithMaxConcurrency ¶
type PubSub ¶
type PubSub struct {
// contains filtered or unexported fields
}
func NewFloodSub ¶
NewFloodSub returns a new FloodSub management object
func (*PubSub) Subscribe ¶
func (p *PubSub) Subscribe(topic string, opts ...SubOpt) (*Subscription, error)
Subscribe returns a new Subscription for the given topic
func (*PubSub) SubscribeByTopicDescriptor ¶
func (p *PubSub) SubscribeByTopicDescriptor(td *pb.TopicDescriptor, opts ...SubOpt) (*Subscription, error)
SubscribeByTopicDescriptor lets you subscribe a topic using a pb.TopicDescriptor
type PubSubNotif ¶
type PubSubNotif PubSub
func (*PubSubNotif) ClosedStream ¶
func (p *PubSubNotif) ClosedStream(n inet.Network, s inet.Stream)
func (*PubSubNotif) Disconnected ¶
func (p *PubSubNotif) Disconnected(n inet.Network, c inet.Conn)
func (*PubSubNotif) ListenClose ¶
func (p *PubSubNotif) ListenClose(n inet.Network, _ ma.Multiaddr)
func (*PubSubNotif) OpenedStream ¶
func (p *PubSubNotif) OpenedStream(n inet.Network, s inet.Stream)
type SubOpt ¶
type SubOpt func(*Subscription) error
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
func (*Subscription) Cancel ¶
func (sub *Subscription) Cancel()
func (*Subscription) Topic ¶
func (sub *Subscription) Topic() string
Click to show internal directories.
Click to hide internal directories.