reconciledloader

package
v0.13.10 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0, MIT Imports: 15 Imported by: 0

Documentation

Overview

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

It verifies the sequence of remote responses matches the sequence of loads called from a local selector traversal.

The reconciled loader also tracks whether or not there is a remote request in progress.

When there is no request in progress, it loads from the local store only.

When there is a request in progress, waits for remote responses before loading, and only calls upon the local store for duplicate blocks and when traversing paths the remote was missing.

The reconciled loader assumes: 1. A single thread is calling AsyncLoad to load blocks 2. When a request is online, a seperate thread may call IngestResponse 3. Either thread may call SetRemoteState or Cleanup 4. The remote sends metadata for all blocks it traverses in the query (per GraphSync protocol spec) - whether or not the actual block is sent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReconciledLoader

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

ReconciledLoader is an instance of the reconciled loader

func NewReconciledLoader

func NewReconciledLoader(requestID graphsync.RequestID, localStore *linking.LinkSystem) *ReconciledLoader

NewReconciledLoader returns a new reconciled loader for the given requestID & localStore

func (*ReconciledLoader) BlockReadOpener

func (rl *ReconciledLoader) BlockReadOpener(lctx linking.LinkContext, link datamodel.Link) types.AsyncLoadResult

BlockReadOpener synchronously loads the next block result as long as the request is online, it will wait for more remote items until it can load this link definitively once the request is offline

func (*ReconciledLoader) Cleanup

func (rl *ReconciledLoader) Cleanup(ctx context.Context)

Cleanup frees up some memory resources for this loader prior to throwing it away

func (*ReconciledLoader) IngestResponse

func (rl *ReconciledLoader) IngestResponse(md graphsync.LinkMetadata, traceLink trace.Link, blocks map[cid.Cid][]byte)

IngestResponse ingests new remote items into the reconciled loader

func (*ReconciledLoader) RetryLastLoad

func (rl *ReconciledLoader) RetryLastLoad() types.AsyncLoadResult

RetryLastLoad retries the last offline load, assuming one is present

func (*ReconciledLoader) SetRemoteOnline

func (rl *ReconciledLoader) SetRemoteOnline(online bool)

SetRemoteState records whether or not the request is online

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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