hamt

package module
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: MIT Imports: 16 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 Blockstore added in v0.0.10

type Blockstore interface {
	Get(cid.Cid) (block.Block, error)
	Put(block.Block) error
}

type CborIpldStore

type CborIpldStore struct {
	Blocks blocks
	Atlas  *atlas.Atlas
}

func CSTFromBstore added in v0.0.10

func CSTFromBstore(bs Blockstore) *CborIpldStore

func NewCborStore

func NewCborStore() *CborIpldStore

func (*CborIpldStore) Get

func (s *CborIpldStore) Get(ctx context.Context, c cid.Cid, out interface{}) error

func (*CborIpldStore) Put

func (s *CborIpldStore) Put(ctx context.Context, v interface{}) (cid.Cid, error)

type KV

type KV struct {
	Key   string
	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(br 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 *CborIpldStore, c cid.Cid, options ...Option) (*Node, error)

func NewNode

func NewNode(cs *CborIpldStore, 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) 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) UnmarshalCBOR added in v0.0.13

func (t *Node) UnmarshalCBOR(br 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