Documentation
¶
Index ¶
- func Block(ctx context.Context, f Fetcher, link ipld.Link) (ipld.Node, error)
- func BlockAll(ctx context.Context, f Fetcher, root ipld.Link, cb FetchCallback) error
- func BlockAllOfType(ctx context.Context, f Fetcher, root ipld.Link, ptype ipld.NodePrototype, ...) error
- func BlockMatching(ctx context.Context, f Fetcher, root ipld.Link, match selector.Selector, ...) error
- type FetchCallback
- type FetchResult
- type Fetcher
- type FetcherConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlockAll ¶
func BlockAll(ctx context.Context, f Fetcher, root ipld.Link, cb FetchCallback) error
BlockAll traverses all nodes in the graph linked by root. The nodes will be untyped and send over the results channel.
func BlockAllOfType ¶
func BlockAllOfType(ctx context.Context, f Fetcher, root ipld.Link, ptype ipld.NodePrototype, cb FetchCallback) error
BlockAllOfType traverses all nodes in the graph linked by root. The nodes will typed according to ptype and send over the results channel.
func BlockMatching ¶
func BlockMatching(ctx context.Context, f Fetcher, root ipld.Link, match selector.Selector, cb FetchCallback) error
BlockMatching traverses a schemaless node graph starting with the given link using the given selector and possibly crossing block boundaries. Each matched node is sent to the FetchResult channel.
Types ¶
type FetchCallback ¶ added in v1.0.0
type FetchCallback func(result FetchResult) error
type FetchResult ¶
type FetchResult struct {
Node ipld.Node
Path ipld.Path
LastBlockPath ipld.Path
LastBlockLink ipld.Link
}
type Fetcher ¶
type Fetcher interface {
// NodeMatching traverses a node graph starting with the provided node using the given selector 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(context.Context, ipld.Node, selector.Selector, FetchCallback) error
// BlockOfType fetches a node graph of the provided type corresponding to single block by link.
BlockOfType(context.Context, ipld.Link, ipld.NodePrototype) (ipld.Node, error)
// BlockMatchingOfType traverses a node graph starting with the given link using the given selector 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(context.Context, ipld.Link, selector.Selector, ipld.NodePrototype, FetchCallback) error
}
type FetcherConfig ¶
type FetcherConfig struct {
// contains filtered or unexported fields
}
func NewFetcherConfig ¶
func NewFetcherConfig(blockService blockservice.BlockService) FetcherConfig
NewFetcherConfig creates a FetchConfig from which session may be created and nodes retrieved.
func (FetcherConfig) NewSession ¶
func (fc FetcherConfig) NewSession(ctx context.Context) Fetcher
NewSession creates a session from which nodes may be retrieved. The session ends when the provided context is canceled.