amt

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2019 License: Apache-2.0, MIT Imports: 13 Imported by: 5

README

go-amt-ipld

Array Mapped Trie (Persistent Vector) implementation using go-ipld

License

Dual MIT and Apache 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxIndex = uint64(1 << 48) // fairly arbitrary, but I don't want to overflow/underflow in nodesForHeight

Functions

func FromArray

func FromArray(bs Blocks, vals []cbg.CBORMarshaler) (cid.Cid, error)

Types

type Blocks

type Blocks interface {
	Get(cid.Cid, cbg.CBORUnmarshaler) error
	Put(cbg.CBORMarshaler) (cid.Cid, error)
}

func WrapBlockstore

func WrapBlockstore(bs blockstore.Blockstore) Blocks

type ErrNotFound

type ErrNotFound struct {
	Index uint64
}

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

func (ErrNotFound) NotFound

func (e ErrNotFound) NotFound() bool

type Node

type Node struct {
	Bmap   []byte
	Links  []cid.Cid
	Values []*cbg.Deferred
	// contains filtered or unexported fields
}

func (*Node) Flush

func (n *Node) Flush(bs Blocks, depth int) error

func (*Node) MarshalCBOR

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

func (*Node) UnmarshalCBOR

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

type Root

type Root struct {
	Height uint64
	Count  uint64
	Node   Node
	// contains filtered or unexported fields
}

func LoadAMT

func LoadAMT(bs Blocks, c cid.Cid) (*Root, error)

func NewAMT

func NewAMT(bs Blocks) *Root

func (*Root) BatchDelete

func (r *Root) BatchDelete(indices []uint64) error

func (*Root) BatchSet

func (r *Root) BatchSet(vals []cbg.CBORMarshaler) error

func (*Root) Delete

func (r *Root) Delete(i uint64) error

func (*Root) Flush

func (r *Root) Flush() (cid.Cid, error)

func (*Root) ForEach

func (r *Root) ForEach(cb func(uint64, *cbg.Deferred) error) error

func (*Root) Get

func (r *Root) Get(i uint64, out interface{}) error

func (*Root) MarshalCBOR

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

func (*Root) Set

func (r *Root) Set(i uint64, val interface{}) error

func (*Root) Subtract

func (r *Root) Subtract(or *Root) error

Subtract removes all elements of 'or' from 'r'

func (*Root) UnmarshalCBOR

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

Directories

Path Synopsis
fuzz module

Jump to

Keyboard shortcuts

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