providerquerymanager

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0, MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProviderQueryManager

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

ProviderQueryManager manages requests to find more providers for blocks for bitswap sessions. It's main goals are to: - rate limit requests -- don't have too many find provider calls running simultaneously - connect to found peers and filter them if it can't connect - ensure two findprovider calls for the same block don't run concurrently - manage timeouts

func New

New initializes a new ProviderQueryManager for a given context and a given network provider.

func (*ProviderQueryManager) FindProvidersAsync

func (pqm *ProviderQueryManager) FindProvidersAsync(sessionCtx context.Context, k cid.Cid) <-chan peer.ID

FindProvidersAsync finds providers for the given block.

func (*ProviderQueryManager) SetFindProviderTimeout

func (pqm *ProviderQueryManager) SetFindProviderTimeout(findProviderTimeout time.Duration)

SetFindProviderTimeout changes the timeout for finding providers

func (*ProviderQueryManager) Startup

func (pqm *ProviderQueryManager) Startup()

Startup starts processing for the ProviderQueryManager.

type ProviderQueryNetwork

type ProviderQueryNetwork interface {
	ConnectTo(context.Context, peer.ID) error
	FindProvidersAsync(context.Context, cid.Cid, int) <-chan peer.ID
}

ProviderQueryNetwork is an interface for finding providers and connecting to peers.

Jump to

Keyboard shortcuts

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