fetcher

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: Apache-2.0, MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const ChainsyncProtocolExtension = graphsync.ExtensionName("chainsync")

ChainsyncProtocolExtension is the extension name to indicate graphsync requests are to sync the chain

Variables

This section is empty.

Functions

This section is empty.

Types

type GraphExchange

type GraphExchange interface {
	Request(ctx context.Context, p peer.ID, root ipld.Link, selector ipld.Node, extensions ...graphsync.ExtensionData) (<-chan graphsync.ResponseProgress, <-chan error)
}

GraphExchange is an interface wrapper to Graphsync so it can be stubbed in unit testing

type GraphSyncFetcher

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

GraphSyncFetcher is used to fetch data over the network. It is implemented using a Graphsync exchange to fetch tipsets recursively

func NewGraphSyncFetcher

func NewGraphSyncFetcher(ctx context.Context, exchange GraphExchange, blockstore bstore.Blockstore,
	v consensus.SyntaxValidator, systemClock clock.Clock, pt graphsyncFallbackPeerTracker) *GraphSyncFetcher

NewGraphSyncFetcher returns a GraphsyncFetcher wired up to the input Graphsync exchange and attached local blockservice for reloading blocks in memory once they are returned

func (*GraphSyncFetcher) FetchTipSetHeaders

func (gsf *GraphSyncFetcher) FetchTipSetHeaders(ctx context.Context, tsKey block.TipSetKey, originatingPeer peer.ID, done func(*block.TipSet) (bool, error)) ([]*block.TipSet, error)

FetchTipSetHeaders behaves as FetchTipSets but it only fetches and syntactically validates a chain of headers, not full blocks.

func (*GraphSyncFetcher) FetchTipSets

func (gsf *GraphSyncFetcher) FetchTipSets(ctx context.Context, tsKey block.TipSetKey, originatingPeer peer.ID, done func(*block.TipSet) (bool, error)) ([]*block.TipSet, error)

FetchTipSets gets Tipsets starting from the given tipset key and continuing until the done function returns true or errors

For now FetchTipSets operates in two parts: 1. It fetches relevant blocks through Graphsync, which writes them to the block store 2. It reads them from the block store and validates their syntax as blocks and constructs a tipset This does have a potentially unwanted side effect of writing blocks to the block store that later don't validate (bitswap actually does this as well)

TODO: In the future, the blocks will be validated directly through graphsync as venus migrates to the same IPLD library used by go-graphsync (go-ipld-prime)

See: https://github.com/filecoin-project/venus/issues/3175

type NotDecodable

type NotDecodable struct {
	Num     int64  `json:"num"`
	Message string `json:"message"`
}

func (*NotDecodable) Clone

func (t *NotDecodable) Clone(b interface{}) error

func (*NotDecodable) MarshalCBOR

func (t *NotDecodable) MarshalCBOR(w io.Writer) error

func (*NotDecodable) UnmarshalCBOR

func (t *NotDecodable) UnmarshalCBOR(r io.Reader) error

Jump to

Keyboard shortcuts

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