dtrack

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2024 License: Apache-2.0, MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunDistanceTracker

func RunDistanceTracker(ctx context.Context, include, exclude map[peer.ID]struct{}, provCache *pcache.ProviderCache, updateIn, timeout time.Duration, options ...Option) (<-chan DistanceUpdate, error)

Types

type AdDistance added in v0.1.0

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

AdDistance finds the distance between advertisements on an IPNI advertisement chain.

func NewAdDistance added in v0.1.0

func NewAdDistance(options ...Option) (*AdDistance, error)

NewAdDistance creates a new advertisement chain distance finder.

func (*AdDistance) Close added in v0.1.0

func (a *AdDistance) Close() error

Close closes the internal dagsync subscriber and the libp2p host if owned by this AdDistance instance.

func (*AdDistance) Get added in v0.1.0

func (a *AdDistance) Get(ctx context.Context, publisher peer.AddrInfo, oldestCid, newestCid cid.Cid) (int, cid.Cid, error)

Get returns the number af advertisements from the newest to the oldest advertisement on an IPNI advertisement chain. If newestCid is cid.Undef, then it referrs to the current head of the chain, and the head CID is returned as the 2nd return value.

type DistanceUpdate

type DistanceUpdate struct {
	ID       peer.ID
	Distance int
	Err      error
}

type Option added in v0.1.0

type Option func(*config)

func WithDepthLimit added in v0.1.0

func WithDepthLimit(limit int64) Option

WithDepthLimit configures the advertisement chain depth limit.

func WithP2pHost added in v0.1.11

func WithP2pHost(p2pHost host.Host) Option

WithP2pHost configures the libp2p host to use for connection to the advertisement publisher.

func WithTopic added in v0.1.0

func WithTopic(topic string) Option

WithTopic configures the topic name used to get the head advertisement when using data-transfer/graphsync.

Jump to

Keyboard shortcuts

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