unixfsnode

package module
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: Apache-2.0, MIT Imports: 16 Imported by: 53

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)

License

Apache-2.0/MIT © Protocol Labs

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUnixFSReificationToLinkSystem

func AddUnixFSReificationToLinkSystem(lsys *ipld.LinkSystem)

func Reify

func Reify(lnkCtx ipld.LinkContext, maybePBNodeRoot ipld.Node, lsys *ipld.LinkSystem) (ipld.Node, error)

Reify looks at an ipld Node and tries to interpret it as a UnixFSNode if successful, it returns the UnixFSNode

func UnixFSPathSelector

func UnixFSPathSelector(path string) datamodel.Node

UnixFSPathSelector creates a selector for a file/path inside of a UnixFS directory if reification is setup on a link system

Types

type PathedPBNode

type PathedPBNode = *_PathedPBNode

func (PathedPBNode) AsBool

func (n PathedPBNode) AsBool() (bool, error)

func (PathedPBNode) AsBytes

func (n PathedPBNode) AsBytes() ([]byte, error)

func (PathedPBNode) AsFloat

func (n PathedPBNode) AsFloat() (float64, error)

func (PathedPBNode) AsInt

func (n PathedPBNode) AsInt() (int64, error)
func (n PathedPBNode) AsLink() (ipld.Link, error)

func (PathedPBNode) AsString

func (n PathedPBNode) AsString() (string, error)

func (PathedPBNode) FieldData

func (n PathedPBNode) FieldData() dagpb.MaybeBytes
func (n PathedPBNode) FieldLinks() dagpb.PBLinks

func (PathedPBNode) IsAbsent

func (n PathedPBNode) IsAbsent() bool

func (PathedPBNode) IsNull

func (n PathedPBNode) IsNull() bool

func (PathedPBNode) Iterator

func (n PathedPBNode) Iterator() *iter.UnixFSDir__Itr

func (PathedPBNode) Kind

func (n PathedPBNode) Kind() ipld.Kind

func (PathedPBNode) Length

func (n PathedPBNode) Length() int64

Length returns the length of a list, or the number of entries in a map, or -1 if the node is not of list nor map kind.

func (PathedPBNode) ListIterator

func (n PathedPBNode) ListIterator() ipld.ListIterator

ListIterator returns an iterator which yields key-value pairs traversing the node. If the node kind is anything other than a list, nil will be returned.

The iterator will yield every entry in the list; that is, it can be expected that itr.Next will be called node.Length times before itr.Done becomes true.

func (PathedPBNode) Lookup

func (n PathedPBNode) Lookup(key dagpb.String) dagpb.Link

func (PathedPBNode) LookupByIndex

func (n PathedPBNode) LookupByIndex(idx int64) (ipld.Node, error)

func (PathedPBNode) LookupByNode

func (n PathedPBNode) LookupByNode(key ipld.Node) (ipld.Node, error)

func (PathedPBNode) LookupBySegment

func (n PathedPBNode) LookupBySegment(seg ipld.PathSegment) (ipld.Node, error)

func (PathedPBNode) LookupByString

func (n PathedPBNode) LookupByString(key string) (ipld.Node, error)

LookupByString looks for the key in the list of links with a matching name

func (PathedPBNode) MapIterator

func (n PathedPBNode) MapIterator() ipld.MapIterator

func (PathedPBNode) Prototype

func (n PathedPBNode) Prototype() ipld.NodePrototype

func (PathedPBNode) Representation

func (n PathedPBNode) Representation() ipld.Node

func (PathedPBNode) Substrate

func (n PathedPBNode) Substrate() ipld.Node

Substrate returns the underlying PBNode -- note: only the substrate will encode successfully to protobuf if writing

func (PathedPBNode) Type

func (PathedPBNode) Type() schema.Type

satisfy schema.TypedNode

Directories

Path Synopsis
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.
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.
builder/quick
Package quickbuilder is designed as a replacement for the existing ipfs-files constructor for a simple way to generate synthetic directory trees.
Package quickbuilder is designed as a replacement for the existing ipfs-files constructor for a simple way to generate synthetic directory trees.
gen
Package test provides ADL testing of the ipld specification around * traversal making use of match subsets * largeByteNode readers
Package test provides ADL testing of the ipld specification around * traversal making use of match subsets * largeByteNode readers

Jump to

Keyboard shortcuts

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