resolver

package
v0.16.3 Latest Latest
Warning

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

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

Documentation

Overview

Package resolver implements utilities for resolving paths within ipfs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrNoLink struct {
	Name string
	Node cid.Cid
}

ErrNoLink is returned when a link is not found in a path.

func (*ErrNoLink) Error

func (e *ErrNoLink) Error() string

Error implements the errors.Error interface.

func (*ErrNoLink) Is added in v0.16.0

func (e *ErrNoLink) Is(err error) bool

Is implements errors.Is interface.

type Resolver

type Resolver interface {
	// ResolveToLastNode walks the given path and returns the CID of the last block
	// referenced by the path, as well as the remainder of the path segments to traverse
	// from the final block boundary to the final node within the block.
	ResolveToLastNode(context.Context, path.ImmutablePath) (cid.Cid, []string, error)

	// ResolvePath fetches the node for the given path. It returns the last item returned
	// by [Resolver.ResolvePathComponents] and the last link traversed which can be used
	// to recover the block.
	ResolvePath(context.Context, path.ImmutablePath) (ipld.Node, ipld.Link, error)

	// ResolvePathComponents fetches the nodes for each segment of the given path. It
	// uses the first path component as the CID of the first node, then resolves all
	// other components walking the links via a selector traversal.
	ResolvePathComponents(context.Context, path.ImmutablePath) ([]ipld.Node, error)
}

Resolver provides path resolution to IPFS.

func NewBasicResolver

func NewBasicResolver(factory fetcher.Factory) Resolver

NewBasicResolver constructs a new basic resolver using the given fetcher.Factory.

Jump to

Keyboard shortcuts

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