requestmanager

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0, MIT Imports: 40 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerHandler

type PeerHandler interface {
	AllocateAndBuildMessage(p peer.ID, blkSize uint64, buildMessageFn func(*messagequeue.Builder))
}

PeerHandler is an interface that can send requests to peers

type PersistenceOptions added in v0.13.0

type PersistenceOptions interface {
	GetLinkSystem(name string) (ipld.LinkSystem, bool)
}

PersistenceOptions is an interface for getting loaders by name

type RequestHooks added in v0.1.0

type RequestHooks interface {
	ProcessRequestHooks(p peer.ID, request graphsync.RequestData) hooks.RequestResult
}

RequestHooks run for new requests

type RequestManager

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

RequestManager tracks outgoing requests and processes incoming reponses to them.

func New

func New(ctx context.Context,
	persistenceOptions PersistenceOptions,
	linkSystem ipld.LinkSystem,
	requestHooks RequestHooks,
	responseHooks ResponseHooks,
	networkErrorListeners *listeners.NetworkErrorListeners,
	outgoingRequestProcessingListeners *listeners.RequestProcessingListeners,
	requestQueue taskqueue.TaskQueue,
	connManager network.ConnManager,
	maxLinksPerRequest uint64,
	panicCallback panics.CallBackFn,
) *RequestManager

New generates a new request manager from a context, network, and selectorQuerier

func (*RequestManager) CancelRequest added in v0.6.9

func (rm *RequestManager) CancelRequest(ctx context.Context, requestID graphsync.RequestID) error

CancelRequest cancels the given request ID and waits for the request to terminate

func (*RequestManager) Disconnected added in v0.6.1

func (rm *RequestManager) Disconnected(p peer.ID)

Disconnected is called when a peer disconnects

func (*RequestManager) GetRequestTask added in v0.10.0

func (rm *RequestManager) GetRequestTask(p peer.ID, task *peertask.Task, requestExecutionChan chan executor.RequestTask)

GetRequestTask gets data for the given task in the request queue

func (*RequestManager) NewRequest added in v0.10.0

func (rm *RequestManager) NewRequest(ctx context.Context,
	p peer.ID,
	root ipld.Link,
	selectorNode ipld.Node,
	extensions ...graphsync.ExtensionData) (<-chan graphsync.ResponseProgress, <-chan error)

NewRequest initiates a new GraphSync request to the given peer.

func (*RequestManager) PauseRequest added in v0.1.0

func (rm *RequestManager) PauseRequest(ctx context.Context, requestID graphsync.RequestID) error

PauseRequest pauses an in progress request (may take 1 or more blocks to process)

func (*RequestManager) PeerState added in v0.10.7

func (rm *RequestManager) PeerState(p peer.ID) peerstate.PeerState

PeerState gets stats on all outgoing requests for a given peer

func (*RequestManager) ProcessResponses

func (rm *RequestManager) ProcessResponses(p peer.ID,
	responses []gsmsg.GraphSyncResponse,
	blks []blocks.Block)

ProcessResponses ingests the given responses from the network and and updates the in progress requests based on those responses.

func (*RequestManager) ReleaseRequestTask added in v0.10.0

func (rm *RequestManager) ReleaseRequestTask(p peer.ID, task *peertask.Task, err error)

ReleaseRequestTask releases a task request the requestQueue

func (*RequestManager) SendRequest

func (rm *RequestManager) SendRequest(p peer.ID, request gsmsg.GraphSyncRequest)

SendRequest sends a request to the message queue

func (*RequestManager) SetDelegate

func (rm *RequestManager) SetDelegate(peerHandler PeerHandler)

SetDelegate specifies who will send messages out to the internet.

func (*RequestManager) Shutdown

func (rm *RequestManager) Shutdown()

Shutdown ends processing for the want manager.

func (*RequestManager) Startup

func (rm *RequestManager) Startup()

Startup starts processing for the WantManager.

func (*RequestManager) UnpauseRequest added in v0.1.0

func (rm *RequestManager) UnpauseRequest(ctx context.Context, requestID graphsync.RequestID, extensions ...graphsync.ExtensionData) error

UnpauseRequest unpauses a request that was paused in a block hook based request ID Can also send extensions with unpause

func (*RequestManager) UpdateRequest added in v0.13.0

func (rm *RequestManager) UpdateRequest(ctx context.Context, requestID graphsync.RequestID, extensions ...graphsync.ExtensionData) error

UpdateRequest updates an in progress request

type ResponseHooks added in v0.1.0

type ResponseHooks interface {
	ProcessResponseHooks(p peer.ID, response graphsync.ResponseData) hooks.UpdateResult
}

ResponseHooks run for new responses

Directories

Path Synopsis
Package reconciledloader implements a block loader that can load from two different sources: - a local store - a series of remote responses for a given graphsync selector query
Package reconciledloader implements a block loader that can load from two different sources: - a local store - a series of remote responses for a given graphsync selector query

Jump to

Keyboard shortcuts

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