Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeMessage ¶
type FakeMessage struct {
// contains filtered or unexported fields
}
FakeMessage is a simple pubsub message
func (*FakeMessage) GetData ¶
func (m *FakeMessage) GetData() []byte
GetData returns the message's payload
func (*FakeMessage) GetFrom ¶
func (m *FakeMessage) GetFrom() peer.ID
GetFrom returns the message's sender ID
type FakeSubscription ¶
type FakeSubscription struct {
// contains filtered or unexported fields
}
FakeSubscription is a fake pubsub subscription.
func NewFakeSubscription ¶
func NewFakeSubscription(topic string, bufSize int) *FakeSubscription
NewFakeSubscription builds a new fake subscription to a topic.
func (*FakeSubscription) AwaitCancellation ¶
func (s *FakeSubscription) AwaitCancellation()
AwaitCancellation waits for the subscription to be canceled by the subscriber.
func (*FakeSubscription) Cancel ¶
func (s *FakeSubscription) Cancel()
Cancel cancels this subscription, after which no subsequently posted messages will be received.
func (*FakeSubscription) Fail ¶
func (s *FakeSubscription) Fail(err error)
Fail causes subsequent reads from this subscription to fail.
func (*FakeSubscription) Next ¶
func (s *FakeSubscription) Next(ctx context.Context) (Message, error)
Next returns the next messages from this subscription.
func (*FakeSubscription) Post ¶
func (s *FakeSubscription) Post(msg Message)
Post posts a new message to this subscription.
func (*FakeSubscription) Topic ¶
func (s *FakeSubscription) Topic() string
Topic returns this subscription's topic.
type Message ¶
Message defines the common interface for go-filecoin message consumers. It's a subset of the go-libp2p-pubsub/pubsub.go Message type.
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher publishes to pubsub topics
func NewPublisher ¶
NewPublisher builds a new publisher
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
Subscriber subscribes to pubsub topics
func NewSubscriber ¶
func NewSubscriber(sub *libp2p.PubSub) *Subscriber
NewSubscriber builds a new subscriber
func (*Subscriber) Subscribe ¶
func (s *Subscriber) Subscribe(topic string) (Subscription, error)
Subscribe subscribes to a pubsub topic
type Subscription ¶
type Subscription interface { // Topic returns this subscription's topic name Topic() string // Next returns the next message from this subscription Next(ctx context.Context) (Message, error) // Cancel cancels this subscription Cancel() }
Subscription is a handle to a pubsub subscription. This matches part of the interface to a libp2p.pubsub.Subscription.