Documentation ¶
Index ¶
- Constants
- func MatchKey(pbLink dagpb.PBLink, key string, maxPadLen int) bool
- func NewUnixFSHAMTShard(ctx context.Context, substrate dagpb.PBNode, data data.UnixFSData, ...) (ipld.Node, error)
- func NewUnixFSHAMTShardWithPreload(ctx context.Context, substrate dagpb.PBNode, data data.UnixFSData, ...) (ipld.Node, error)
- type ErrInvalidLinkName
- type UnixFSHAMTShard
- func (n UnixFSHAMTShard) AsBool() (bool, error)
- func (n UnixFSHAMTShard) AsBytes() ([]byte, error)
- func (n UnixFSHAMTShard) AsFloat() (float64, error)
- func (n UnixFSHAMTShard) AsInt() (int64, error)
- func (n UnixFSHAMTShard) AsLink() (ipld.Link, error)
- func (n UnixFSHAMTShard) AsString() (string, error)
- func (n UnixFSHAMTShard) FieldData() dagpb.MaybeBytes
- func (n UnixFSHAMTShard) FieldLinks() dagpb.PBLinks
- func (n UnixFSHAMTShard) IsAbsent() bool
- func (n UnixFSHAMTShard) IsNull() bool
- func (n UnixFSHAMTShard) Iterator() *iter.UnixFSDir__Itr
- func (n UnixFSHAMTShard) Kind() ipld.Kind
- func (n UnixFSHAMTShard) Length() int64
- func (n UnixFSHAMTShard) ListIterator() ipld.ListIterator
- func (n UnixFSHAMTShard) Lookup(key dagpb.String) dagpb.Link
- func (n UnixFSHAMTShard) LookupByIndex(idx int64) (ipld.Node, error)
- func (n UnixFSHAMTShard) LookupByNode(key ipld.Node) (ipld.Node, error)
- func (n UnixFSHAMTShard) LookupBySegment(seg ipld.PathSegment) (ipld.Node, error)
- func (n UnixFSHAMTShard) MapIterator() ipld.MapIterator
- func (n UnixFSHAMTShard) Prototype() ipld.NodePrototype
- func (n UnixFSHAMTShard) Representation() ipld.Node
- func (n UnixFSHAMTShard) Substrate() ipld.Node
- func (UnixFSHAMTShard) Type() schema.Type
Constants ¶
const ( // ErrNotProtobuf indicates an error attempting to load a HAMT from a non-protobuf node ErrNotProtobuf errorType = "node was not a protobuf node" // ErrNotUnixFSNode indicates an error attempting to load a HAMT from a generic protobuf node ErrNotUnixFSNode errorType = "node was not a UnixFS node" // ErrInvalidChildIndex indicates there is no link to load for the given child index ErrInvalidChildIndex errorType = "invalid index passed to operate children (likely corrupt bitfield)" // ErrHAMTTooDeep indicates we attempted to load from a HAMT node that went past the depth of the tree ErrHAMTTooDeep errorType = "sharded directory too deep" // ErrInvalidHashType indicates the HAMT node's hash function is unsupported (must be Murmur3) ErrInvalidHashType errorType = "only murmur3 supported as hash function" // ErrNoDataField indicates the HAMT node's UnixFS structure lacked a data field, which is // where a bit mask is stored ErrNoDataField errorType = "'Data' field not present" // ErrNoFanoutField indicates the HAMT node's UnixFS structure lacked a fanout field, which is required ErrNoFanoutField errorType = "'Fanout' field not present" // ErrHAMTSizeInvalid indicates the HAMT's size property was not an exact power of 2 ErrHAMTSizeInvalid errorType = "hamt size should be a power of two" // ErrMissingLinkName indicates a link in a HAMT had no Name property (required for all HAMTs) ErrMissingLinkName errorType = "missing link name" )
const ( // HashMurmur3 is the multiformats identifier for Murmur3 HashMurmur3 uint64 = 0x22 )
Variables ¶
This section is empty.
Functions ¶
func NewUnixFSHAMTShard ¶
func NewUnixFSHAMTShard(ctx context.Context, substrate dagpb.PBNode, data data.UnixFSData, lsys *ipld.LinkSystem) (ipld.Node, error)
NewUnixFSHAMTShard attempts to construct a UnixFSHAMTShard node from the base protobuf node plus a decoded UnixFSData structure
func NewUnixFSHAMTShardWithPreload ¶ added in v1.5.1
func NewUnixFSHAMTShardWithPreload(ctx context.Context, substrate dagpb.PBNode, data data.UnixFSData, lsys *ipld.LinkSystem) (ipld.Node, error)
NewUnixFSHAMTShardWithPreload attempts to construct a UnixFSHAMTShard node from the base protobuf node plus a decoded UnixFSData structure, and then iterate through and load the full set of hamt shards.
Types ¶
type ErrInvalidLinkName ¶
type ErrInvalidLinkName struct {
Name string
}
ErrInvalidLinkName indicates a link's name was too short for a HAMT
func (ErrInvalidLinkName) Error ¶
func (e ErrInvalidLinkName) Error() string
type UnixFSHAMTShard ¶
type UnixFSHAMTShard = *_UnixFSHAMTShard
UnixFSHAMTShared is an IPLD Prime Node that provides a read interface to a UnixFS HAMT
func AttemptHAMTShardFromNode ¶
func AttemptHAMTShardFromNode(ctx context.Context, nd ipld.Node, lsys *ipld.LinkSystem) (UnixFSHAMTShard, error)
AttemptHAMTShardFromNode attempts to read a HAMT shard from a general protobuf node
func (UnixFSHAMTShard) AsBool ¶
func (n UnixFSHAMTShard) AsBool() (bool, error)
func (UnixFSHAMTShard) AsBytes ¶
func (n UnixFSHAMTShard) AsBytes() ([]byte, error)
func (UnixFSHAMTShard) AsFloat ¶
func (n UnixFSHAMTShard) AsFloat() (float64, error)
func (UnixFSHAMTShard) AsInt ¶
func (n UnixFSHAMTShard) AsInt() (int64, error)
func (UnixFSHAMTShard) AsLink ¶
func (n UnixFSHAMTShard) AsLink() (ipld.Link, error)
func (UnixFSHAMTShard) AsString ¶
func (n UnixFSHAMTShard) AsString() (string, error)
func (UnixFSHAMTShard) FieldData ¶
func (n UnixFSHAMTShard) FieldData() dagpb.MaybeBytes
func (UnixFSHAMTShard) FieldLinks ¶
func (n UnixFSHAMTShard) FieldLinks() dagpb.PBLinks
func (UnixFSHAMTShard) IsAbsent ¶
func (n UnixFSHAMTShard) IsAbsent() bool
func (UnixFSHAMTShard) IsNull ¶
func (n UnixFSHAMTShard) IsNull() bool
func (UnixFSHAMTShard) Iterator ¶
func (n UnixFSHAMTShard) Iterator() *iter.UnixFSDir__Itr
func (UnixFSHAMTShard) Kind ¶
func (n UnixFSHAMTShard) Kind() ipld.Kind
func (UnixFSHAMTShard) Length ¶
func (n UnixFSHAMTShard) 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 (UnixFSHAMTShard) ListIterator ¶
func (n UnixFSHAMTShard) 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 (UnixFSHAMTShard) LookupByIndex ¶
func (n UnixFSHAMTShard) LookupByIndex(idx int64) (ipld.Node, error)
func (UnixFSHAMTShard) LookupByNode ¶
func (n UnixFSHAMTShard) LookupByNode(key ipld.Node) (ipld.Node, error)
func (UnixFSHAMTShard) LookupBySegment ¶
func (n UnixFSHAMTShard) LookupBySegment(seg ipld.PathSegment) (ipld.Node, error)
func (UnixFSHAMTShard) MapIterator ¶
func (n UnixFSHAMTShard) MapIterator() ipld.MapIterator
func (UnixFSHAMTShard) Prototype ¶
func (n UnixFSHAMTShard) Prototype() ipld.NodePrototype
func (UnixFSHAMTShard) Representation ¶
func (n UnixFSHAMTShard) Representation() ipld.Node
func (UnixFSHAMTShard) Substrate ¶
func (n UnixFSHAMTShard) Substrate() ipld.Node