hamt

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 11 Imported by: 21

README

go-hamt-ipld

Travis CI

A CHAMP HAMT implemented using ipld

Table of Contents

Examples

// TODO

Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © Whyrusleeping

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMaxDepth = fmt.Errorf("attempted to traverse hamt beyond max depth")
View Source
var ErrNotFound = fmt.Errorf("not found")

Functions

This section is empty.

Types

type KV

type KV struct {
	Key   []byte
	Value *cbg.Deferred
}

func (*KV) MarshalCBOR added in v0.0.13

func (t *KV) MarshalCBOR(w io.Writer) error

func (*KV) UnmarshalCBOR added in v0.0.13

func (t *KV) UnmarshalCBOR(r io.Reader) error

type Node

type Node struct {
	Bitfield *big.Int   `refmt:"bf"`
	Pointers []*Pointer `refmt:"p"`
	// contains filtered or unexported fields
}

func LoadNode

func LoadNode(ctx context.Context, cs cbor.IpldStore, c cid.Cid, options ...Option) (*Node, error)

func NewNode

func NewNode(cs cbor.IpldStore, options ...Option) *Node

NewNode creates a new IPLD HAMT Node with the given store and given options

func (*Node) Copy

func (n *Node) Copy() *Node

func (*Node) Delete

func (n *Node) Delete(ctx context.Context, k string) error

func (*Node) Find

func (n *Node) Find(ctx context.Context, k string, out interface{}) error

func (*Node) FindRaw added in v0.1.0

func (n *Node) FindRaw(ctx context.Context, k string) ([]byte, error)

func (*Node) Flush

func (n *Node) Flush(ctx context.Context) error

func (*Node) ForEach added in v0.0.11

func (n *Node) ForEach(ctx context.Context, f func(k string, val interface{}) error) error

func (*Node) MarshalCBOR added in v0.0.13

func (t *Node) MarshalCBOR(w io.Writer) error

func (*Node) Set

func (n *Node) Set(ctx context.Context, k string, v interface{}) error

func (*Node) SetRaw added in v0.1.0

func (n *Node) SetRaw(ctx context.Context, k string, raw []byte) error

SetRaw sets key k to cbor bytes raw

func (*Node) UnmarshalCBOR added in v0.0.13

func (t *Node) UnmarshalCBOR(r io.Reader) error

type Option added in v0.0.13

type Option func(*Node)

Option is a function that configures the node

func UseTreeBitWidth added in v0.0.13

func UseTreeBitWidth(bitWidth int) Option

UseTreeBitWidth allows you to set the width of the HAMT tree in bits (from 1-8) via a customized hash function

type Pointer

type Pointer struct {
	KVs  []*KV   `refmt:"v,omitempty"`
	Link cid.Cid `refmt:"l,omitempty"`
	// contains filtered or unexported fields
}

func (*Pointer) MarshalCBOR added in v0.0.13

func (t *Pointer) MarshalCBOR(w io.Writer) error

func (*Pointer) UnmarshalCBOR added in v0.0.13

func (t *Pointer) UnmarshalCBOR(br io.Reader) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL