asyncloader

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncLoader

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

AsyncLoader manages loading links asynchronously in as new responses come in from the network

func New

func New(ctx context.Context, linkSystem ipld.LinkSystem) *AsyncLoader

New initializes a new link loading manager for asynchronous loads from the given context and local store loading and storing function

func (*AsyncLoader) AsyncLoad

func (al *AsyncLoader) AsyncLoad(p peer.ID, requestID graphsync.RequestID, link ipld.Link, linkContext ipld.LinkContext) <-chan types.AsyncLoadResult

AsyncLoad asynchronously loads the given link for the given request ID. It returns a channel for data and a channel for errors -- only one message will be sent over either.

func (*AsyncLoader) CleanupRequest

func (al *AsyncLoader) CleanupRequest(p peer.ID, requestID graphsync.RequestID)

CleanupRequest indicates the given request is complete on the client side, and no further attempts will be made to load links for this request, so any cached response data is invalid can be cleaned

func (*AsyncLoader) CompleteResponsesFor

func (al *AsyncLoader) CompleteResponsesFor(requestID graphsync.RequestID)

CompleteResponsesFor indicates no further responses will come in for the given requestID, so if no responses are in the cache or local store, a link load should not retry

func (*AsyncLoader) ProcessResponse

func (al *AsyncLoader) ProcessResponse(
	ctx context.Context,
	responses map[graphsync.RequestID]metadata.Metadata,
	blks []blocks.Block)

ProcessResponse injests new responses and completes asynchronous loads as neccesary

func (*AsyncLoader) RegisterPersistenceOption added in v0.1.0

func (al *AsyncLoader) RegisterPersistenceOption(name string, lsys ipld.LinkSystem) error

RegisterPersistenceOption registers a new loader/storer option for processing requests

func (*AsyncLoader) StartRequest

func (al *AsyncLoader) StartRequest(requestID graphsync.RequestID, persistenceOption string) error

StartRequest indicates the given request has started and the manager should continually attempt to load links for this request as new responses come in

func (*AsyncLoader) UnregisterPersistenceOption added in v0.1.0

func (al *AsyncLoader) UnregisterPersistenceOption(name string) error

UnregisterPersistenceOption unregisters an existing loader/storer option for processing requests

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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