store

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const SCHEMA_v0 = `` /* 515-byte string literal not displayed */

SMALLINT is int16, INTEGER is int32, BIGINT is int64 HASH index uses a 4-byte hash of the indexed column, which is lossy/approx but compact kind IN (2,3,5,6) is (TX_PUBKEYHASH,TX_SCRIPTHASH,TX_WITNESS_V0_KEYHASH,TX_WITNESS_V0_SCRIPTHASH)

Variables

View Source
var MIGRATIONS = []storelib.Migration{
	{Version: 1, SQL: SCHEMA_v0},
}

Functions

This section is empty.

Types

type IndexStore

type IndexStore struct {
	StoreBase
}

func (*IndexStore) Clone

func (s *IndexStore) Clone() (StoreImpl, *StoreBase, Store, StoreTx)

Clone makes a copy of the store implementation (because storelib can't do this part)

func (*IndexStore) CreateUTXOs

func (s *IndexStore) CreateUTXOs(createUTXOs []spec.UTXO, height int64) error

CreateUTXOs inserts new UTXOs at `height` (can replace Removed UTXOs)

func (*IndexStore) FindUTXOs

func (s *IndexStore) FindUTXOs(kind doge.ScriptType, address []byte) (res []spec.UTXO, err error)

func (*IndexStore) GetBalance added in v0.0.3

func (s *IndexStore) GetBalance(kind doge.ScriptType, address []byte, confirmations int64) (res spec.Balance, err error)

func (*IndexStore) GetResumePoint

func (s *IndexStore) GetResumePoint() ([]byte, error)

func (*IndexStore) RemoveUTXOs

func (s *IndexStore) RemoveUTXOs(removeUTXOs []spec.OutPointKey, height int64) error

RemoveUTXOs marks UTXOs as spent at `height`

func (*IndexStore) SetResumePoint

func (s *IndexStore) SetResumePoint(hash []byte, height int64) error

func (*IndexStore) TrimSpentUTXOs

func (s *IndexStore) TrimSpentUTXOs(height int64) error

TrimSpentUTXOs permanently deletes all 'Removed' UTXOs below `height`

func (*IndexStore) UndoAbove

func (s *IndexStore) UndoAbove(height int64) error

UndoAbove removes created UTXOs and re-activates Removed UTXOs above `height`.

type Store

type Store = spec.Store

Type aliases to enhance readability

func NewIndexStore

func NewIndexStore(fileName string, ctx context.Context) (Store, error)

NewIndexStore returns a spec.Store implementation that uses Postgres or SQLite

type StoreBase

type StoreBase = storelib.StoreBase[Store, StoreTx]

type StoreImpl

type StoreImpl = storelib.StoreImpl[Store, StoreTx]

type StoreTx

type StoreTx = spec.StoreTx

Jump to

Keyboard shortcuts

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