fetcher

package module
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: Apache-2.0, MIT Imports: 2 Imported by: 12

README

go-fetcher

❗ This repo is no longer maintained.

👉 We highly recommend switching to the maintained version at https://github.com/ipfs/boxo/tree/main/fetcher. 🏎️ Good news! There is tooling and documentation to expedite a switch in your repo.

⚠️ If you continue using this repo, please note that security fixes will not be provided (unless someone steps in to maintain it).

📚 Learn more, including how to take the maintainership mantle or ask questions, here.

Go-fetcher is a library to retrieve IPLD prime nodes from IPFS using data exchange protocols

License

The go-fetcher project is dual-licensed under Apache 2.0 and MIT terms:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory deprecated added in v1.3.0

type Factory interface {
	NewSession(ctx context.Context) Fetcher
}

Factory is anything that can create new sessions of the fetcher

Deprecated: use github.com/ipfs/boxo/fetcher.Factory

type FetchCallback deprecated added in v1.0.0

type FetchCallback func(result FetchResult) error

FetchCallback is called for each node traversed during a fetch

Deprecated: use github.com/ipfs/boxo/fetcher.FetchCallback

type FetchResult deprecated

type FetchResult struct {
	Node          ipld.Node
	Path          ipld.Path
	LastBlockPath ipld.Path
	LastBlockLink ipld.Link
}

FetchResult is a single node read as part of a dag operation called on a fetcher

Deprecated: use github.com/ipfs/boxo/fetcher.FetchResult

type Fetcher deprecated

type Fetcher interface {
	// NodeMatching traverses a node graph starting with the provided root node using the given selector node and
	// possibly crossing block boundaries. Each matched node is passed as FetchResult to the callback. Errors returned
	// from callback will halt the traversal. The sequence of events is: NodeMatching begins, the callback is called zero
	// or more times with a FetchResult, then NodeMatching returns.
	NodeMatching(ctx context.Context, root ipld.Node, selector ipld.Node, cb FetchCallback) error

	// BlockOfType fetches a node graph of the provided type corresponding to single block by link.
	BlockOfType(ctx context.Context, link ipld.Link, nodePrototype ipld.NodePrototype) (ipld.Node, error)

	// BlockMatchingOfType traverses a node graph starting with the given root link using the given selector node and
	// possibly crossing block boundaries. The nodes will be typed using the provided prototype. Each matched node is
	// passed as a FetchResult to the callback. Errors returned from callback will halt the traversal.
	// The sequence of events is: BlockMatchingOfType begins, the callback is called zero or more times with a
	// FetchResult, then BlockMatchingOfType returns.
	BlockMatchingOfType(
		ctx context.Context,
		root ipld.Link,
		selector ipld.Node,
		nodePrototype ipld.NodePrototype,
		cb FetchCallback) error

	// Uses the given link to pick a prototype to build the linked node.
	PrototypeFromLink(link ipld.Link) (ipld.NodePrototype, error)
}

Fetcher is an interface for reading from a dag. Reads may be local or remote, and may employ data exchange protocols like graphsync and bitswap

Deprecated: use github.com/ipfs/boxo/fetcher.Fetcher

Directories

Path Synopsis
impl

Jump to

Keyboard shortcuts

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