providerquerymanager

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: Apache-2.0, MIT Imports: 9 Imported by: 0

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