Documentation
¶
Overview ¶
package path 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 Resolver ¶
type Resolver struct {
DAG merkledag.DAGService
}
Resolver provides path resolution to IPFS It has a pointer to a DAGService, which is uses to resolve nodes.
func (*Resolver) ResolveLinks ¶
func (s *Resolver) ResolveLinks(ndd *merkledag.Node, names []string) (
nd *merkledag.Node, err error)
ResolveLinks iteratively resolves names by walking the link hierarchy. Every node is fetched from the DAGService, resolving the next name. Returns the last node found.
ResolveLinks(nd, []string{"foo", "bar", "baz"}) would retrieve "baz" in ("bar" in ("foo" in nd.Links).Links).Links
func (*Resolver) ResolvePath ¶
func (s *Resolver) ResolvePath(fpath string) (*merkledag.Node, error)
ResolvePath fetches the node for given path. It uses the first path component as a hash (key) of the first node, then resolves all other components walking the links, with ResolveLinks.