memory

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: AGPL-3.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

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

Storage implements the db.Storage interface

func NewMemoryStorage

func NewMemoryStorage() *Storage

NewMemoryStorage returns a new Storage

func (*Storage) Get

func (m *Storage) Get(_ context.Context, key []byte) (*merkletree.Node, error)

Get retrieves a value from a key in the db.Storage

func (*Storage) GetRoot

func (m *Storage) GetRoot(_ context.Context) (*merkletree.Hash, error)

GetRoot returns current merkletree root

func (*Storage) Iterate

func (m *Storage) Iterate(_ context.Context,
	f func([]byte, *merkletree.Node) (bool, error)) error

Iterate implements the method Iterate of the interface db.Storage

func (*Storage) List

func (m *Storage) List(ctx context.Context,
	limit int) ([]merkletree.KV, error)

List implements the method List of the interface db.Storage

func (*Storage) Put

func (m *Storage) Put(_ context.Context, key []byte,
	node *merkletree.Node) error

Put inserts new node into merkletree

func (*Storage) SetRoot

func (m *Storage) SetRoot(_ context.Context, hash *merkletree.Hash) error

SetRoot updates current merkletree root

func (*Storage) WithPrefix

func (m *Storage) WithPrefix(prefix []byte) merkletree.Storage

WithPrefix implements the method WithPrefix of the interface db.Storage

Jump to

Keyboard shortcuts

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