pool

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const Version0 = "0"

Variables

View Source
var (
	PubSubPrototypes struct {
		Announcement schema.TypedPrototype
	}
)

Functions

This section is empty.

Types

type Announcement

type Announcement struct {
	Version string
	Type    AnnouncementType
	Addrs   []string
}

func (*Announcement) GetAddrs

func (a *Announcement) GetAddrs() ([]multiaddr.Multiaddr, error)

func (*Announcement) MarshalBinary

func (a *Announcement) MarshalBinary() ([]byte, error)

func (*Announcement) SetAddrs

func (a *Announcement) SetAddrs(ma ...multiaddr.Multiaddr)

func (*Announcement) UnmarshalBinary

func (a *Announcement) UnmarshalBinary(b []byte) error

type AnnouncementType

type AnnouncementType int
const (
	UnknownAnnouncementType AnnouncementType = iota
	IExistAnnouncementType
)

type Option

type Option func(*options) error

func WithAnnounceInterval

func WithAnnounceInterval(i time.Duration) Option

WithAnnounceInterval sets the interval at which announcements are made on the pubsub. Defaults to 5 seconds if unset.

func WithHost

func WithHost(h host.Host) Option

WithHost sets the libp2p host on which the pool is exposed. If unset a default host with random identity is used. See: libp2p.New.

func WithPoolName

func WithPoolName(n string) Option

WithPoolName sets a human readable name for the pool. Required.

func WithTopicName

func WithTopicName(n string) Option

WithTopicName sets the name of the topic onto which announcements are made. Defaults to "/explore.fula/pools/<pool-name>" if unset. See: WithPoolName.

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

func New

func New(o ...Option) (*Pool, error)

func (*Pool) Shutdown

func (p *Pool) Shutdown(ctx context.Context) error

func (*Pool) Start

func (p *Pool) Start(ctx context.Context) error

Jump to

Keyboard shortcuts

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