share

package
v0.4.6-dirty Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNegativeInterval = errors.New("interval must be positive")
)

Functions

func CacheAvailability

func CacheAvailability[A share.Availability](lc fx.Lifecycle, ds datastore.Batching, avail A) share.Availability

CacheAvailability wraps either Full or Light availability with a cache for result sampling.

func Discovery

func Discovery(cfg Config) func(routing.ContentRouting, host.Host) *share.Discovery

func Module

func Module(tp node.Type, cfg *Config, options ...fx.Option) fx.Option

Types

type Config

type Config struct {
	// PeersLimit defines how many peers will be added during discovery.
	PeersLimit uint
	// DiscoveryInterval is an interval between discovery sessions.
	DiscoveryInterval time.Duration
	// AdvertiseInterval is a interval between advertising sessions.
	// NOTE: only full and bridge can advertise themselves.
	AdvertiseInterval time.Duration
}

func DefaultConfig

func DefaultConfig() Config

func (*Config) Validate

func (cfg *Config) Validate() error

Validate performs basic validation of the config.

Jump to

Keyboard shortcuts

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