Categorygithub.com/ipfs/go-unixfsnode
modulepackage
1.9.0
Repository: https://github.com/ipfs/go-unixfsnode.git
Documentation: pkg.go.dev

# README

go-unixfsnode

This is an IPLD ADL that provides string based pathing for protobuf nodes. The top level node behaves like a map where LookupByString returns the Hash property on the Link in the protobufs list of Links whos Name property matches the key. This should enable selector traversals that work based of paths.

Note that while it works internally with go-codec-dagpb, the Reify method (used to get a UnixFSNode from a DagPB node should actually work successfully with go-ipld-prime-proto nodes)

Usage

The primary interaction with this package is to register an ADL on a link system. This is done with via a helper method.

AddUnixFSReificationToLinkSystem(lsys *ipld.LinkSystem)

For link systems which have UnixFS reification registered, two ADLs will be available to the InterpretAs selector: 'unixfs' and 'unixfs-preload'. The different between these two ADLs is that the preload variant will access all blocks within a UnixFS Object (file or directory) when that object is accessed by a selector traversal. The non-preload variant in contrast will only access the subset of blocks strictly needed for the traversal. In practice, this means the subset of a sharded directory needed to access a specific file, or the sub-range of a file directly accessed by a range selector.

License

Apache-2.0/MIT © Protocol Labs

# Packages

Package data provides tools for working with the UnixFS data structure that is encoded in the "Data" field of the larger a DagPB encoded IPLD node.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Package test provides ADL testing of the ipld specification around * traversal making use of match subsets * largeByteNode readers.
Package testutil provides utilities for writing tests that require nontrivial UnixFS data of various forms.
No description provided by the author

# Functions

AddUnixFSReificationToLinkSystem will add both unixfs and unixfs-preload reifiers to a LinkSystem.
BytesConsumingMatcher is a traversal.WalkMatching matcher function that consumes the bytes of a LargeBytesNode where one is matched.
Reify looks at an ipld Node and tries to interpret it as a UnixFSNode if successful, it returns the UnixFSNode.
UnixFSPathSelector creates a selector for IPLD path to a UnixFS resource if UnixFS reification is setup on a LinkSystem being used for traversal.
UnixFSPathSelectorBuilder creates a selector for IPLD path to a UnixFS resource if UnixFS reification is setup on a LinkSystem being used for traversal.

# Variables

ExploreAllRecursivelySelector is a selector that will explore all nodes.
MatchUnixFSEntitySelector is a selector that will match a single node and its direct children.
MatchUnixFSPreloadSelector is a selector that will match a single node, similar to selectorparse.CommonSelector_MatchPoint, but uses the "unixfs-preload" ADL to load sharded files and directories as a single node.
MatchUnixFSSelector is a selector that will match a single node, similar to selectorparse.CommonSelector_MatchPoint, but uses the "unixfs" ADL to load as UnixFS data.