Crate fvm_ipld_hamt

Source
Expand description

HAMT crate for use as rust IPLD data structure

Data structure reference

Implementation based off the work @dignifiedquire started here. This implementation matched the rust HashMap interface very closely, but came at the cost of saving excess values to the database and requiring unsafe code to update the cache from the underlying store as well as discarding any errors that came in any operations. The function signatures that exist are based on this, but refactored to match the spec more closely and match the necessary implementation.

The Hamt is a data structure that mimmics a HashMap which has the features of being sharded, persisted, and indexable by a Cid. The Hamt supports a variable bit width to adjust the amount of possible pointers that can exist at each height of the tree. Hamt can be modified at any point, but the underlying values are only persisted to the store when the flush is called.

Structs§

BytesKey
Key type to be used to serialize as byte string instead of a u8 array. This type is used as a default for the Hamt as this is the only allowed type with the go implementation.
Config
Configuration options for a HAMT instance.

Enums§

Error
HAMT Error
Sha256
Sha256 hashing algorithm used for hashing keys in the Hamt.

Traits§

Hash
Custom trait to avoid issues like https://github.com/rust-lang/rust/issues/27108.
HashAlgorithm
Algorithm used as the hasher for the Hamt.

Type Aliases§

Hamt
Implementation of the HAMT data structure for IPLD.
Hamtv0
Legacy amt V0
Iter
Iterator over HAMT Key/Value tuples.
Iterv0
Iterator over HAMT Key/Value tuples (hamt v0).