storage

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashValue added in v0.5.0

func HashValue(val []byte) mpf.Hash

Types

type BadgerLogger

type BadgerLogger struct{}

BadgerLogger is a wrapper type to give our logger the expected interface

func NewBadgerLogger

func NewBadgerLogger() *BadgerLogger

func (*BadgerLogger) Debugf added in v0.10.0

func (b *BadgerLogger) Debugf(msg string, args ...any)

func (*BadgerLogger) Errorf added in v0.10.0

func (b *BadgerLogger) Errorf(msg string, args ...any)

func (*BadgerLogger) Infof added in v0.10.0

func (b *BadgerLogger) Infof(msg string, args ...any)

func (*BadgerLogger) Warningf

func (b *BadgerLogger) Warningf(msg string, args ...any)

type Storage

type Storage struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func GetStorage

func GetStorage() *Storage

func (*Storage) AddUtxo

func (s *Storage) AddUtxo(
	address string,
	txId string,
	txOutIdx uint32,
	txOutBytes []byte,
	slot uint64,
) error

func (*Storage) GetBlockData

func (s *Storage) GetBlockData(dest any) error

func (*Storage) GetCursor

func (s *Storage) GetCursor() (uint64, string, error)

func (*Storage) GetScriptRefUtxo added in v0.12.0

func (s *Storage) GetScriptRefUtxo(txId string, outputIdx int) ([]byte, error)

func (*Storage) GetUtxos

func (s *Storage) GetUtxos(address string) ([][]byte, error)

func (*Storage) Load

func (s *Storage) Load() error

func (*Storage) PurgeDeletedUtxos added in v0.8.0

func (s *Storage) PurgeDeletedUtxos(beforeSlot uint64) error

func (*Storage) RemoveUtxo

func (s *Storage) RemoveUtxo(
	address string,
	txId string,
	utxoIdx uint32,
	slot uint64,
) error

func (*Storage) Rollback added in v0.8.0

func (s *Storage) Rollback(slot uint64) error

func (*Storage) Trie added in v0.5.0

func (s *Storage) Trie() *Trie

func (*Storage) UpdateBlockData

func (s *Storage) UpdateBlockData(blockData any) error

func (*Storage) UpdateCursor

func (s *Storage) UpdateCursor(slotNumber uint64, blockHash string) error

type Trie added in v0.5.0

type Trie struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewTrie added in v0.5.0

func NewTrie(db *badger.DB, keyPrefix string) (*Trie, error)

func (*Trie) Delete added in v0.5.0

func (t *Trie) Delete(key []byte) error

func (*Trie) Hash added in v0.5.0

func (t *Trie) Hash() []byte

func (*Trie) HashKey added in v0.5.0

func (t *Trie) HashKey(key []byte) []byte

HashKey returns a blake2b-256 hash for use in key values

func (*Trie) Prove added in v0.5.0

func (t *Trie) Prove(key []byte) (*mpf.Proof, error)

func (*Trie) Rollback added in v0.8.0

func (t *Trie) Rollback(slot uint64) error

func (*Trie) Update added in v0.5.0

func (t *Trie) Update(key []byte, val []byte, slot uint64) error

Jump to

Keyboard shortcuts

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