Categorygithub.com/filecoin-project/go-hamt-ipld/v2
modulepackage
2.0.0
Repository: https://github.com/filecoin-project/go-hamt-ipld.git
Documentation: pkg.go.dev

# README

go-hamt-ipld

Travis CI

This package is a reference implementation of the IPLD HAMT used in the Filecoin blockchain. It includes some optional flexibility such that it may be used for other purposes outside of Filecoin.

HAMT is a "hash array mapped trie". This implementation extends the standard form by including buckets for the key/value pairs at storage leaves and CHAMP mutation semantics. The CHAMP invariant and mutation rules provide us with the ability to maintain canonical forms given any set of keys and their values, regardless of insertion order and intermediate data insertion and deletion. Therefore, for any given set of keys and their values, a HAMT using the same parameters and CHAMP semantics, the root node should always produce the same content identifier (CID).

See https://godoc.org/github.com/filecoin-project/go-hamt-ipld for more information and API details.

License

MIT © Whyrusleeping

# Packages

No description provided by the author

# Functions

LoadNode loads a HAMT Node from the IpldStore and configures it according to any specified Option parameters.
NewNode creates a new IPLD HAMT Node with the given IPLD store and any additional options (bitWidth and hash function).
UseHashFunction allows you to set the hash function used for internal indexing by the HAMT.
UseTreeBitWidth allows you to set a custom bitWidth of the HAMT in bits (from 1-8).

# Variables

ErrMalformedHamt is returned whenever a block intended as a HAMT node does not conform to the expected form that a block may take.
ErrMaxDepth is returned when the HAMT spans further than the hash function is capable of representing.
ErrNotFound is returned when a Find operation fails to locate the specified key in the HAMT.

# Structs

KV represents leaf storage within a HAMT node.
Node is a single point in the HAMT, encoded as an IPLD tuple in DAG-CBOR of shape: [bytes, [Pointer...]] where 'bytes' is the big.Int#Bytes() and the Pointers array is between 1 and `2^bitWidth`.
Pointer is an element in a HAMT node's Pointers array, encoded as an IPLD tuple in DAG-CBOR of shape: {"0": CID} or {"1": [KV...]} Where a map with a single key of "0" contains a Link, where a map with a single key of "1" contains a KV bucket.

# Type aliases

Option is a function that configures the node See UseTreeBitWidth and UseHashFunction.