Categorygithub.com/filecoin-project/go-hamt-ipld/v3
modulepackage
3.4.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

Diff returns a set of changes that transform node 'prev' into node 'cur'.
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).
ParallelDiff returns a set of changes that transform node 'prev' into node 'cur'.
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).

# Constants

These constants define the changes that can be applied to a DAG.
return MODIFIED when a key value mapping is overwritten.
These constants define the changes that can be applied to a DAG.
use NOVERWRITE for modifyValue operations that cannot overwrite existing values.
use OVERWRITE for modifyValue operations that overwrite existing values.
These constants define the changes that can be applied to a DAG.
return UNMODIFIED when a no key value mappings are overwritten.

# 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.

# Structs

Change represents a change to a DAG and contains a reference to the old and new CIDs.
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: CID or [KV...] i.e.

# Type aliases

ChangeType denotes type of change in Change.
HashFunc is a hashing function for values.
Option is a function that configures a HAMT.