worker

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TopicPeerNoCheckPeriods = 500 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type StreamGetter

type StreamGetter func(protocol.ID) (network.Stream, error)

type StreamWorker

type StreamWorker struct {
	ProtoID protocol.ID
	SGetter StreamGetter
}

func (StreamWorker) Stream

func (sw StreamWorker) Stream() (network.Stream, error)

type TopicReader

type TopicReader func(*TopicWorker)

type TopicWorker

type TopicWorker struct {
	Pub *pubsub.Topic

	Sub *pubsub.Subscription
	// contains filtered or unexported fields
}

func (*TopicWorker) BroadCast

func (tw *TopicWorker) BroadCast(data []byte) error

func (*TopicWorker) ID

func (tw *TopicWorker) ID() string

func (*TopicWorker) PeersOfTopic

func (tw *TopicWorker) PeersOfTopic() []peer.ID

func (*TopicWorker) ReadMsg

func (tw *TopicWorker) ReadMsg() (*pubsub.Message, error)

func (*TopicWorker) Stop

func (tw *TopicWorker) Stop()

func (*TopicWorker) WriteData

func (tw *TopicWorker) WriteData(data []byte) error

type WorkGroup

type WorkGroup map[string]*TopicWorker

func (*WorkGroup) StartUp

func (wg *WorkGroup) StartUp(ctx context.Context, ps *pubsub.PubSub, topics map[string]TopicReader, timeOut time.Duration) error

func (*WorkGroup) StopWork

func (wg *WorkGroup) StopWork()

type Worker

type Worker interface {
	Stop()
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL