pool

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: MIT Imports: 30 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 WithDatastore added in v0.4.8

func WithDatastore(ds datastore.Batching) Option

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 WithLinkSystem added in v0.4.8

func WithLinkSystem(ls *ipld.LinkSystem) Option

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) Fetch added in v0.4.8

func (p *Pool) Fetch(ctx context.Context, from peer.ID, l ipld.Link) error

func (*Pool) Has added in v0.4.8

func (p *Pool) Has(ctx context.Context, l ipld.Link) (bool, error)

func (*Pool) Load added in v0.4.8

func (p *Pool) Load(ctx context.Context, l ipld.Link, np ipld.NodePrototype) (ipld.Node, error)

func (*Pool) Shutdown

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

func (*Pool) Start

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

func (*Pool) Store added in v0.4.8

func (p *Pool) Store(ctx context.Context, n ipld.Node) (ipld.Link, error)

Jump to

Keyboard shortcuts

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