asyncloader

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: MIT, Apache-2.0, MIT Imports: 11 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, loader ipld.Loader, storer ipld.Storer) *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(requestID graphsync.RequestID, link ipld.Link) <-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(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(responses map[graphsync.RequestID]metadata.Metadata,
	blks []blocks.Block)

ProcessResponse injests new responses and completes asynchronous loads as neccesary

func (*AsyncLoader) RegisterPersistenceOption

func (al *AsyncLoader) RegisterPersistenceOption(name string, loader ipld.Loader, storer ipld.Storer) error

RegisterPersistenceOption registers a new loader/storer option for processing requests

func (*AsyncLoader) Shutdown

func (al *AsyncLoader) Shutdown()

Shutdown finishes processing of messages

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) Startup

func (al *AsyncLoader) Startup()

Startup starts processing of messages

func (*AsyncLoader) UnregisterPersistenceOption

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