discovery

package module
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 10 Imported by: 159

README

DEPRECATION NOTICE

This package has moved into go-libp2p, split into multiple sub-packages: github.com/libp2p/go-libp2p/p2p/discovery.

go-libp2p-discovery

Discourse posts

Interfaces for active peer discovery

This package contains interfaces and utilities for active peer discovery. Peers providing a service use the interface to advertise their presence in some namespace. Vice versa, peers seeking a service use the interface to discover peers that have previously advertised as service providers. The package also includes a baseline implementation for discovery through Content Routing.

Documenation

See https://godoc.org/github.com/libp2p/go-libp2p-discovery.

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

License

MIT


The last gx published version of this module was: 1.0.15: QmWA8k8apx6egshEjemkuxpKNJS7W7heCgzTnBhAvX9yoB

Documentation

Overview

Deprecated: This package has moved into go-libp2p, split into multiple sub-packages: github.com/libp2p/go-libp2p/p2p/discovery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Advertise(ctx context.Context, a discovery.Advertiser, ns string, opts ...discovery.Option)

Advertise is a utility function that persistently advertises a service through an Advertiser. Deprecated: use go-libp2p/p2p/discovery/routing.Advertise instead.

func FindPeers

func FindPeers(ctx context.Context, d discovery.Discoverer, ns string, opts ...discovery.Option) ([]peer.AddrInfo, error)

FindPeers is a utility function that synchronously collects peers from a Discoverer. Deprecated: use go-libp2p/p2p/discovery/routing.FindPeers instead.

func FullJitter added in v0.2.0

func FullJitter(duration, min, max time.Duration, rng *rand.Rand) time.Duration

FullJitter returns a random number uniformly chose from the range [min, boundedDur]. boundedDur is the duration bounded between min and max. Deprecated: use go-libp2p/p2p/discovery/backoff.FullJitter instead.

func NewBackoffDiscovery deprecated added in v0.2.0

func NewBackoffDiscovery(disc discovery.Discovery, stratFactory BackoffFactory, opts ...BackoffDiscoveryOption) (discovery.Discovery, error)

Deprecated: use go-libp2p/p2p/discovery/backoff.NewBackoffDiscovery instead.

func NoJitter added in v0.2.0

func NoJitter(duration, min, max time.Duration, rng *rand.Rand) time.Duration

NoJitter returns the duration bounded between min and max Deprecated: use go-libp2p/p2p/discovery/backoff.NoJitter instead.

Types

type BackoffConnector added in v0.2.0

type BackoffConnector = dbackoff.BackoffConnector

BackoffConnector is a utility to connect to peers, but only if we have not recently tried connecting to them already Deprecated: use go-libp2p/p2p/discovery/backoff.BackoffConnector inste

func NewBackoffConnector added in v0.2.0

func NewBackoffConnector(h host.Host, cacheSize int, connectionTryDuration time.Duration, backoff BackoffFactory) (*BackoffConnector, error)

NewBackoffConnector creates a utility to connect to peers, but only if we have not recently tried connecting to them already cacheSize is the size of a TwoQueueCache connectionTryDuration is how long we attempt to connect to a peer before giving up backoff describes the strategy used to decide how long to backoff after previously attempting to connect to a peer Deprecated: use go-libp2p/p2p/discovery/backoff.NewBackoffConnector instead.

type BackoffDiscovery added in v0.2.0

type BackoffDiscovery = dbackoff.BackoffDiscovery

BackoffDiscovery is an implementation of discovery that caches peer data and attenuates repeated queries Deprecated: use go-libp2p/p2p/discovery/backoff.BackoffDiscovery instead.

type BackoffDiscoveryOption deprecated added in v0.2.0

type BackoffDiscoveryOption = dbackoff.BackoffDiscoveryOption

Deprecated: use go-libp2p/p2p/discovery/backoff.BackoffDiscoveryOption instead.

func WithBackoffDiscoveryReturnedChannelSize added in v0.2.0

func WithBackoffDiscoveryReturnedChannelSize(size int) BackoffDiscoveryOption

WithBackoffDiscoveryReturnedChannelSize sets the size of the buffer to be used during a FindPeer query. Note: This does not apply if the query occurs during the backoff time Deprecated: use go-libp2p/p2p/discovery/backoff.WithBackoffDiscoveryReturnedChannelSize instead.

func WithBackoffDiscoverySimultaneousQueryBufferSize added in v0.2.0

func WithBackoffDiscoverySimultaneousQueryBufferSize(size int) BackoffDiscoveryOption

WithBackoffDiscoverySimultaneousQueryBufferSize sets the buffer size for the channels between the main FindPeers query for a given namespace and all simultaneous FindPeers queries for the namespace Deprecated: use go-libp2p/p2p/discovery/backoff.WithBackoffDiscoverySimultaneousQueryBufferSize instead.

type BackoffFactory deprecated added in v0.2.0

type BackoffFactory = dbackoff.BackoffFactory

Deprecated: use go-libp2p/p2p/discovery/backoff.BackoffFactory instead.

func NewExponentialBackoff added in v0.2.0

func NewExponentialBackoff(min, max time.Duration, jitter Jitter,
	timeUnits time.Duration, base float64, offset time.Duration, rngSrc rand.Source) BackoffFactory

NewExponentialBackoff creates a BackoffFactory with backoff of the form base^x + offset where x is the attempt number jitter is the function for adding randomness around the backoff timeUnits are the units of time the base^x is evaluated in Deprecated: use go-libp2p/p2p/discovery/backoff.NewExponentialBackoff instead.

func NewExponentialDecorrelatedJitter added in v0.2.0

func NewExponentialDecorrelatedJitter(min, max time.Duration, base float64, rngSrc rand.Source) BackoffFactory

NewExponentialDecorrelatedJitter creates a BackoffFactory with backoff of the roughly of the form base^x where x is the attempt number. Delays start at the minimum duration and after each attempt delay = rand(min, delay * base), bounded by the max See https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/ for more information Deprecated: use go-libp2p/p2p/discovery/backoff.NewExponentialDecorrelatedJitter instead.

func NewFixedBackoff added in v0.2.0

func NewFixedBackoff(delay time.Duration) BackoffFactory

NewFixedBackoff creates a BackoffFactory with a constant backoff duration Deprecated: use go-libp2p/p2p/discovery/backoff.NewFixedBackoff instead.

func NewPolynomialBackoff added in v0.2.0

func NewPolynomialBackoff(min, max time.Duration, jitter Jitter,
	timeUnits time.Duration, polyCoefs []float64, rngSrc rand.Source) BackoffFactory

NewPolynomialBackoff creates a BackoffFactory with backoff of the form c0*x^0, c1*x^1, ...cn*x^n where x is the attempt number jitter is the function for adding randomness around the backoff timeUnits are the units of time the polynomial is evaluated in polyCoefs is the array of polynomial coefficients from [c0, c1, ... cn] Deprecated: use go-libp2p/p2p/discovery/backoff.NewPolynomialBackoff instead.

type BackoffStrategy added in v0.2.0

type BackoffStrategy = dbackoff.BackoffStrategy

BackoffStrategy describes how backoff will be implemented. BackoffStratgies are stateful. Deprecated: use go-libp2p/p2p/discovery/backoff.BackoffStrategy instead.

type DiscoveryRouting deprecated added in v0.2.0

type DiscoveryRouting = drouting.DiscoveryRouting

Deprecated: use go-libp2p/p2p/discovery/routing.RoutingDiscovery instead.

func NewDiscoveryRouting deprecated added in v0.2.0

func NewDiscoveryRouting(disc discovery.Discovery, opts ...discovery.Option) *DiscoveryRouting

Deprecated: use go-libp2p/p2p/discovery/routing.NewDiscoveryRouting instead.

type Jitter added in v0.2.0

type Jitter = dbackoff.Jitter

Jitter must return a duration between min and max. Min must be lower than, or equal to, max. Deprecated: use go-libp2p/p2p/discovery/backoff.Jitter instead.

type RoutingDiscovery

type RoutingDiscovery = drouting.RoutingDiscovery

RoutingDiscovery is an implementation of discovery using ContentRouting. Namespaces are translated to Cids using the SHA256 hash. Deprecated: use go-libp2p/p2p/discovery/routing.RoutingDiscovery instead.

func NewRoutingDiscovery deprecated

func NewRoutingDiscovery(router routing.ContentRouting) *RoutingDiscovery

Deprecated: use go-libp2p/p2p/discovery/routing.NewRoutingDiscovery instead.

Jump to

Keyboard shortcuts

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