Documentation
¶
Index ¶
- Variables
- func Reify(root ipld.Node) (ipld.Node, error)
- type Bucket
- type BucketEntry
- type Builder
- func (b *Builder) AssignBool(bool) error
- func (b *Builder) AssignBytes([]byte) error
- func (b *Builder) AssignFloat(float64) error
- func (b *Builder) AssignInt(int64) error
- func (b *Builder) AssignLink(ipld.Link) error
- func (b *Builder) AssignNode(ipld.Node) error
- func (b *Builder) AssignNull() error
- func (b *Builder) AssignString(string) error
- func (b *Builder) BeginList(sizeHint int64) (ipld.ListAssembler, error)
- func (b *Builder) BeginMap(sizeHint int64) (ipld.MapAssembler, error)
- func (b *Builder) Build() ipld.Node
- func (b *Builder) Prototype() ipld.NodePrototype
- func (b *Builder) Reset()
- func (b Builder) WithLinking(system ipld.LinkSystem, proto ipld.LinkPrototype) *Builder
- type Element
- type FilecoinV3Prototype
- type HashMapNode
- type HashMapRoot
- type Node
- func (*Node) AsBool() (bool, error)
- func (*Node) AsBytes() ([]byte, error)
- func (*Node) AsFloat() (float64, error)
- func (*Node) AsInt() (int64, error)
- func (*Node) AsLink() (ipld.Link, error)
- func (*Node) AsString() (string, error)
- func (*Node) IsAbsent() bool
- func (*Node) IsNull() bool
- func (*Node) Kind() ipld.Kind
- func (n *Node) Length() int64
- func (*Node) ListIterator() ipld.ListIterator
- func (*Node) LookupByIndex(idx int64) (ipld.Node, error)
- func (n *Node) LookupByNode(key ipld.Node) (ipld.Node, error)
- func (n *Node) LookupBySegment(seg ipld.PathSegment) (ipld.Node, error)
- func (n *Node) LookupByString(s string) (ipld.Node, error)
- func (n *Node) MapIterator() ipld.MapIterator
- func (n Node) Prototype() datamodel.NodePrototype
- func (n *Node) Substrate() ipld.Node
- func (n Node) WithLinking(system ipld.LinkSystem, proto ipld.LinkPrototype) *Node
- type Prototype
Constants ¶
This section is empty.
Variables ¶
var ( HashMapNodePrototype schema.TypedPrototype HashMapRootPrototype schema.TypedPrototype )
var ErrMalformedHamt = errors.New("malformed HAMT node")
ErrMalformedHamt is returned whenever a block intended as a HAMT node does not conform to the expected form that a block may take. This can occur during block-load where initial validation takes place or during traversal where certain conditions are expected to be met.
Functions ¶
func Reify ¶
func Reify(root ipld.Node) (ipld.Node, error)
Reify looks at an ipld Node and tries to interpret it as a HAMT; if successful, it returns the synthetic Node which can be used to access the entire HAMT as if it was a single simple map.
Presumably the node given as a parameter is "raw" data model. (Nothing enforces this, however.)
Reify is one of the ways you can create a HAMT node, but it's not the only one. Reify is most suitable if you've got a bunch of data you already parsed into a tree raw. Other approaches include using the synthetic builder (if you just want to engage at the "build a map" level), or using Schemas to denote where the HAMT should appear (in which case loading data while using the schema should automatically reify the HAMT without further action required).
Types ¶
type Bucket ¶
type Bucket []BucketEntry
type BucketEntry ¶
type BucketEntry struct { Key []byte Value ipld.Node }
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func (*Builder) AssignBool ¶
func (*Builder) AssignBytes ¶
func (*Builder) AssignFloat ¶
func (*Builder) AssignLink ¶
func (*Builder) AssignNode ¶
func (*Builder) AssignNull ¶
func (*Builder) AssignString ¶
func (Builder) WithLinking ¶
type FilecoinV3Prototype ¶
type FilecoinV3Prototype struct{}
func (FilecoinV3Prototype) NewBuilder ¶
func (p FilecoinV3Prototype) NewBuilder() ipld.NodeBuilder
type HashMapNode ¶
type HashMapRoot ¶
type HashMapRoot struct { HashAlg multicodec.Code BucketSize int Hamt HashMapNode }
type Node ¶
type Node struct { HashMapRoot // contains filtered or unexported fields }
func (*Node) ListIterator ¶
func (*Node) ListIterator() ipld.ListIterator
func (*Node) LookupByIndex ¶
func (*Node) LookupByNode ¶
func (*Node) LookupBySegment ¶
func (*Node) LookupByString ¶
func (*Node) MapIterator ¶
func (n *Node) MapIterator() ipld.MapIterator
func (Node) Prototype ¶
func (n Node) Prototype() datamodel.NodePrototype