generickv

package
v0.0.0-...-a3efb56 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountsInitLightTest

func AccountsInitLightTest(tb testing.TB, db dbForInit, initAccounts map[basics.Address]basics.AccountData, proto config.ConsensusParams) (newDatabase bool, err error)

AccountsInitLightTest initializes the database for testing with the given accounts.

This is duplicate due to a specific legacy test in accdeltas_test.go. TODO: remove the need for this.

func AccountsInitTest

func AccountsInitTest(tb testing.TB, db dbForInit, initAccounts map[basics.Address]basics.AccountData, proto protocol.ConsensusVersion) (newDatabase bool)

AccountsInitTest initializes the database for testing with the given accounts.

func CreatableEntryMaxSize

func CreatableEntryMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func MakeAccountsReader

func MakeAccountsReader(kvr KvRead, proto config.ConsensusParams) *accountsReader

MakeAccountsReader returns a kv db agnostic AccountsReader.

func MakeAccountsWriter

func MakeAccountsWriter(kvw KvWrite, kvr KvRead) *accountsWriter

MakeAccountsWriter returns a kv db agnostic AccountsWriter. TODO: we should discuss what is the best approach for this `kvr KvRead`. the problem is that `OnlineAccountsDelete` requires reading and writing. the cleanest approach is to move that method to a separate interface, and have it only be available on 'transactions'. although a snapshot+batch should be able to support it too since its all reads, then writes.

func MakeCatchpoint

func MakeCatchpoint() trackerdb.Catchpoint

MakeCatchpoint returns a trackerdb.Catchpoint for a KV

func MakeOnlineAccountsWriter

func MakeOnlineAccountsWriter(kvw KvWrite) trackerdb.OnlineAccountsWriter

MakeOnlineAccountsWriter constructs an kv agnostic OnlineAccountsWriter

func MakeReader

func MakeReader(kvr KvRead, proto config.ConsensusParams) trackerdb.Reader

MakeReader returns a trackerdb.Reader for a KV

func MakeStateproofReader

func MakeStateproofReader(kvr KvRead) trackerdb.SpVerificationCtxReader

MakeStateproofReader returns a trackerdb.SpVerificationCtxReader for a KV

func MakeStateproofWriter

func MakeStateproofWriter(kvw KvWrite) trackerdb.SpVerificationCtxWriter

MakeStateproofWriter returns a trackerdb.SpVerificationCtxWriter for a KV

func MakeWriter

func MakeWriter(store trackerdb.Store, kvw KvWrite, kvr KvRead) trackerdb.Writer

MakeWriter returns a trackerdb.Writer for a KV

func RunMigrations

func RunMigrations(ctx context.Context, db dbForMigrations, params trackerdb.Params, targetVersion int32) (mgr trackerdb.InitParams, err error)

RunMigrations runs the migrations on the store up to the target version.

Types

type KvIter

type KvIter interface {
	Next() bool
	Key() []byte
	KeySlice() Slice
	Value() ([]byte, error)
	ValueSlice() (Slice, error)
	Valid() bool
	Close()
}

KvIter is a low level KV iterator.

type KvRead

type KvRead interface {
	Get(key []byte) ([]byte, io.Closer, error)
	NewIter(low, high []byte, reverse bool) KvIter
}

KvRead is a low level KV db interface for reading.

type KvWrite

type KvWrite interface {
	Set(key, value []byte) error
	Delete(key []byte) error
	DeleteRange(start, end []byte) error
}

KvWrite is a low level KV db interface for writing.

type Slice

type Slice interface {
	Data() []byte
	Free()
	Size() int
	Exists() bool
}

Slice is a low level slice used during the KV iterator.

Jump to

Keyboard shortcuts

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