mst

package
v0.0.0-...-45ae864 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntryUndefined = 0
	EntryLeaf      = 1
	EntryTree      = 2
)

Variables

View Source
var ErrNotFound = fmt.Errorf("mst: not found")

Functions

This section is empty.

Types

type DiffOp

type DiffOp struct {
	Depth  int
	Op     string
	Tid    string
	OldCid cid.Cid
	NewCid cid.Cid
}

func DiffTrees

func DiffTrees(ctx context.Context, bs blockstore.Blockstore, from, to cid.Cid) ([]*DiffOp, error)

TODO: this code isnt great, should be rewritten on top of the baseline datastructures once functional and correct

type MerkleSearchTree

type MerkleSearchTree struct {
	// contains filtered or unexported fields
}

func LoadMST

func LoadMST(cst cbor.IpldStore, fanout int, root cid.Cid) *MerkleSearchTree

func NewMST

func NewMST(cst cbor.IpldStore, fanout int, ptr cid.Cid, entries []NodeEntry, layer int) *MerkleSearchTree

func (*MerkleSearchTree) Add

func (mst *MerkleSearchTree) Add(ctx context.Context, key string, val cid.Cid, knownZeros int) (*MerkleSearchTree, error)

func (*MerkleSearchTree) Delete

func (mst *MerkleSearchTree) Delete(ctx context.Context, k string) (*MerkleSearchTree, error)

func (*MerkleSearchTree) Get

func (mst *MerkleSearchTree) Get(ctx context.Context, k string) (cid.Cid, error)

func (*MerkleSearchTree) GetPointer

func (mst *MerkleSearchTree) GetPointer(ctx context.Context) (cid.Cid, error)

func (*MerkleSearchTree) WalkLeavesFrom

func (mst *MerkleSearchTree) WalkLeavesFrom(ctx context.Context, key string, cb func(n NodeEntry) error) error

type NodeData

type NodeData struct {
	L *cid.Cid    `cborgen:"l"`
	E []TreeEntry `cborgen:"e"`
}

func (*NodeData) MarshalCBOR

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

func (*NodeData) UnmarshalCBOR

func (t *NodeData) UnmarshalCBOR(r io.Reader) (err error)

type NodeEntry

type NodeEntry struct {
	Kind int
	Key  string
	Val  cid.Cid
	Tree *MerkleSearchTree
}

type TreeEntry

type TreeEntry struct {
	P    int64    `cborgen:"p"`
	K    string   `cborgen:"k"`
	V    cid.Cid  `cborgen:"v"`
	Tree *cid.Cid `cborgen:"t"`
}

func (*TreeEntry) MarshalCBOR

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

func (*TreeEntry) UnmarshalCBOR

func (t *TreeEntry) UnmarshalCBOR(r io.Reader) (err error)

Jump to

Keyboard shortcuts

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