store

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const ProofOpMultiStore = "multistore"

the multi-store proof operation constant value

Variables

This section is empty.

Functions

func DefaultProofRuntime

func DefaultProofRuntime() (prt *merkle.ProofRuntime)

XXX: This should be managed by the rootMultiStore which may want to register more proof ops?

func ElemKey

func ElemKey(index uint64) []byte

Key for the elements of the list

func First

func First(st KVStore, start, end []byte) (kv cmn.KVPair, ok bool)

Gets the first item.

func Last

func Last(st KVStore, start, end []byte) (kv cmn.KVPair, ok bool)

Gets the last item. `end` is exclusive.

func LengthKey

func LengthKey() []byte

Key for the length of the list

func MultiStoreProofOpDecoder

func MultiStoreProofOpDecoder(pop merkle.ProofOp) (merkle.ProofOperator, error)

MultiStoreProofOpDecoder returns a multi-store merkle proof operator from a given proof operation.

func NewCacheKVStore

func NewCacheKVStore(parent KVStore) *cacheKVStore

nolint

func NewCommitMultiStore

func NewCommitMultiStore(db dbm.DB) *rootMultiStore

nolint

func RequireProof

func RequireProof(subpath string) bool

RequireProof return whether proof is require for the subpath

func TopKey

func TopKey() []byte

Key for the top element position in the queue

Types

type CacheKVStore

type CacheKVStore = types.CacheKVStore

Import cosmos-sdk/types/store.go for convenience. nolint

type CacheMultiStore

type CacheMultiStore = types.CacheMultiStore

Import cosmos-sdk/types/store.go for convenience. nolint

type CacheWrap

type CacheWrap = types.CacheWrap

Import cosmos-sdk/types/store.go for convenience. nolint

type CacheWrapper

type CacheWrapper = types.CacheWrapper

Import cosmos-sdk/types/store.go for convenience. nolint

type CommitID

type CommitID = types.CommitID

Import cosmos-sdk/types/store.go for convenience. nolint

type CommitInfo

type CommitInfo struct {

	// Version
	Version int64

	// Store info for
	StoreInfos []StoreInfo
}

NOTE: Keep CommitInfo a simple immutable struct.

func (CommitInfo) CommitID

func (ci CommitInfo) CommitID() CommitID

func (CommitInfo) Hash

func (ci CommitInfo) Hash() []byte

Hash returns the simple merkle root hash of the stores sorted by name.

type CommitKVStore

type CommitKVStore = types.CommitKVStore

Import cosmos-sdk/types/store.go for convenience. nolint

type CommitMultiStore

type CommitMultiStore = types.CommitMultiStore

Import cosmos-sdk/types/store.go for convenience. nolint

type CommitStore

type CommitStore = types.CommitStore

Import cosmos-sdk/types/store.go for convenience. nolint

func LoadIAVLStore

func LoadIAVLStore(db dbm.DB, id CommitID, pruning sdk.PruningStrategy) (CommitStore, error)

load the iavl store

type Committer

type Committer = types.Committer

Import cosmos-sdk/types/store.go for convenience. nolint

type IavlStore

type IavlStore struct {

	// The underlying tree.
	Tree *iavl.MutableTree
	// contains filtered or unexported fields
}

IavlStore Implements KVStore and CommitStore.

func (*IavlStore) CacheWrap

func (st *IavlStore) CacheWrap() CacheWrap

Implements Store.

func (*IavlStore) CacheWrapWithTrace

func (st *IavlStore) CacheWrapWithTrace(w io.Writer, tc TraceContext) CacheWrap

CacheWrapWithTrace implements the Store interface.

func (*IavlStore) Commit

func (st *IavlStore) Commit() CommitID

Implements Committer.

func (*IavlStore) Delete

func (st *IavlStore) Delete(key []byte)

Implements KVStore.

func (*IavlStore) Get

func (st *IavlStore) Get(key []byte) (value []byte)

Implements KVStore.

func (*IavlStore) GetImmutableTree

func (st *IavlStore) GetImmutableTree() *iavl.ImmutableTree

func (*IavlStore) GetStoreType

func (st *IavlStore) GetStoreType() StoreType

Implements Store.

func (*IavlStore) Has

func (st *IavlStore) Has(key []byte) (exists bool)

Implements KVStore.

func (*IavlStore) Iterator

func (st *IavlStore) Iterator(start, end []byte) Iterator

Implements KVStore.

func (*IavlStore) LastCommitID

func (st *IavlStore) LastCommitID() CommitID

Implements Committer.

func (*IavlStore) Prefix

func (st *IavlStore) Prefix(prefix []byte) KVStore

Implements KVStore

func (*IavlStore) Query

func (st *IavlStore) Query(req abci.RequestQuery) (res abci.ResponseQuery)

Query implements ABCI interface, allows queries

by default we will return from (latest height -1), as we will have merkle proofs immediately (header height = data height + 1) If latest-1 is not present, use latest (which must be present) if you care to have the latest data to see a tx results, you must explicitly set the height you want to see

func (*IavlStore) ReverseIterator

func (st *IavlStore) ReverseIterator(start, end []byte) Iterator

Implements KVStore.

func (*IavlStore) Set

func (st *IavlStore) Set(key, value []byte)

Implements KVStore.

func (*IavlStore) SetPruning

func (st *IavlStore) SetPruning(pruning sdk.PruningStrategy)

Implements Committer.

func (*IavlStore) SetVersion

func (st *IavlStore) SetVersion(version int64)

func (*IavlStore) VersionExists

func (st *IavlStore) VersionExists(version int64) bool

VersionExists returns whether or not a given version is stored.

type Iterator

type Iterator = types.Iterator

Import cosmos-sdk/types/store.go for convenience. nolint

type KVPair

type KVPair = types.KVPair

Import cosmos-sdk/types/store.go for convenience. nolint

type KVStore

type KVStore = types.KVStore

Import cosmos-sdk/types/store.go for convenience. nolint

type List

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

List defines an integer indexable mapper It panics when the element type cannot be (un/)marshalled by the codec

func NewList

func NewList(cdc *codec.Codec, store sdk.KVStore) List

NewList constructs new List

func (List) Delete

func (m List) Delete(index uint64)

Delete() deletes the element in the given position Other elements' indices are preserved after deletion Panics when the index is out of range

func (List) Get

func (m List) Get(index uint64, ptr interface{}) error

Get() returns the element by its index

func (List) Iterate

func (m List) Iterate(ptr interface{}, fn func(uint64) bool)

CONTRACT: No writes may happen within a domain while iterating over it.

func (List) Len

func (m List) Len() (res uint64)

Len() returns the length of the list The length is only increased by Push() and not decreased List dosen't check if an index is in bounds The user should check Len() before doing any actions

func (List) Push

func (m List) Push(value interface{})

Push() inserts the element to the end of the list It will increase the length when it is called

func (List) Set

func (m List) Set(index uint64, value interface{})

Set() stores the element to the given position Setting element out of range will break length counting Use Push() instead of Set() to append a new element

type MultiStore

type MultiStore = types.MultiStore

Import cosmos-sdk/types/store.go for convenience. nolint

type MultiStoreProof

type MultiStoreProof struct {
	StoreInfos []StoreInfo
}

MultiStoreProof defines a collection of store proofs in a multi-store

func NewMultiStoreProof

func NewMultiStoreProof(storeInfos []StoreInfo) *MultiStoreProof

func (*MultiStoreProof) ComputeRootHash

func (proof *MultiStoreProof) ComputeRootHash() []byte

ComputeRootHash returns the root hash for a given multi-store proof.

type MultiStoreProofOp

type MultiStoreProofOp struct {

	// To encode in ProofOp.Data.
	Proof *MultiStoreProof `json:"proof"`
	// contains filtered or unexported fields
}

TODO: document

func NewMultiStoreProofOp

func NewMultiStoreProofOp(key []byte, proof *MultiStoreProof) MultiStoreProofOp

func (MultiStoreProofOp) GetKey

func (op MultiStoreProofOp) GetKey() []byte

GetKey returns the key for a multi-store proof operation.

func (MultiStoreProofOp) ProofOp

func (op MultiStoreProofOp) ProofOp() merkle.ProofOp

ProofOp return a merkle proof operation from a given multi-store proof operation.

func (MultiStoreProofOp) Run

func (op MultiStoreProofOp) Run(args [][]byte) ([][]byte, error)

Run executes a multi-store proof operation for a given value. It returns the root hash if the value matches all the store's commitID's hash or an error otherwise.

func (MultiStoreProofOp) String

func (op MultiStoreProofOp) String() string

String implements the Stringer interface for a mult-store proof operation.

type PrefixNodeDB

type PrefixNodeDB struct {
	*iavl.NodeDB
	// contains filtered or unexported fields
}

type PruningStrategy

type PruningStrategy = types.PruningStrategy

Import cosmos-sdk/types/store.go for convenience. nolint

type Queryable

type Queryable = types.Queryable

Import cosmos-sdk/types/store.go for convenience. nolint

type Queue

type Queue struct {
	List List
}

Queue is a List wrapper that provides queue-like functions It panics when the element type cannot be (un/)marshalled by the codec

func NewQueue

func NewQueue(cdc *codec.Codec, store sdk.KVStore) Queue

NewQueue constructs new Queue

func (Queue) Flush

func (m Queue) Flush(ptr interface{}, fn func() bool)

Flush() removes elements it processed Return true in the continuation to break The interface{} is unmarshalled before the continuation is called Starts from the top(head) of the queue CONTRACT: Pop() or Push() should not be performed while flushing

func (Queue) IsEmpty

func (m Queue) IsEmpty() bool

IsEmpty() checks if the queue is empty

func (Queue) Peek

func (m Queue) Peek(ptr interface{}) error

Popping/Peeking on an empty queue will cause panic The user should check IsEmpty() before doing any actions Peek() returns the element at the front of the queue without removing it

func (Queue) Pop

func (m Queue) Pop()

Pop() returns the element at the front of the queue and removes it

func (Queue) Push

func (m Queue) Push(value interface{})

Push() inserts the elements to the rear of the queue

type StateSyncHelper

type StateSyncHelper struct {
	SnapshotHeights chan int64
	HeightsToDelete chan int64
	// contains filtered or unexported fields
}

func NewStateSyncHelper

func NewStateSyncHelper(
	logger log.Logger,
	db dbm.DB,
	cms sdk.CommitMultiStore,
	cdc *codec.Codec) *StateSyncHelper

func (*StateSyncHelper) DeleteSnapshot

func (helper *StateSyncHelper) DeleteSnapshot(height int64) error

func (*StateSyncHelper) Init

func (helper *StateSyncHelper) Init(lastBreatheBlockHeight int64)

Split Init method and NewStateSyncHelper for snapshot command

func (StateSyncHelper) ReloadSnapshotRoutine

func (helper StateSyncHelper) ReloadSnapshotRoutine(height int64, retry int)

the method might take quite a while, BETTER to be called concurrently so we only do it once a day after breathe block

func (*StateSyncHelper) StartRecovery

func (helper *StateSyncHelper) StartRecovery(manifest *abci.Manifest) error

func (*StateSyncHelper) WriteRecoveryChunk

func (helper *StateSyncHelper) WriteRecoveryChunk(hash abci.SHA256Sum, chunk *abci.AppStateChunk, isComplete bool) (err error)

type Store

type Store = types.Store

Import cosmos-sdk/types/store.go for convenience. nolint

type StoreCore

type StoreCore struct {
	// StoreType StoreType
	CommitID CommitID
}

type StoreInfo

type StoreInfo struct {
	Name string
	Core StoreCore
}

StoreInfo contains the name and core reference for an underlying store. It is the leaf of the rootMultiStores top level simple merkle tree.

func (StoreInfo) Hash

func (si StoreInfo) Hash() []byte

Implements merkle.Hasher.

type StoreKey

type StoreKey = types.StoreKey

Import cosmos-sdk/types/store.go for convenience. nolint

type StoreType

type StoreType = types.StoreType

Import cosmos-sdk/types/store.go for convenience. nolint

type TraceContext

type TraceContext = types.TraceContext

Import cosmos-sdk/types/store.go for convenience. nolint

type TraceKVStore

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

TraceKVStore implements the KVStore interface with tracing enabled. Operations are traced on each core KVStore call and written to the underlying io.writer.

TODO: Should we use a buffered writer and implement Commit on TraceKVStore?

func NewTraceKVStore

func NewTraceKVStore(parent sdk.KVStore, writer io.Writer, tc TraceContext) *TraceKVStore

NewTraceKVStore returns a reference to a new traceKVStore given a parent KVStore implementation and a buffered writer.

func (*TraceKVStore) CacheWrap

func (tkv *TraceKVStore) CacheWrap() sdk.CacheWrap

CacheWrap implements the KVStore interface. It panics as a TraceKVStore cannot be cache wrapped.

func (*TraceKVStore) CacheWrapWithTrace

func (tkv *TraceKVStore) CacheWrapWithTrace(_ io.Writer, _ TraceContext) CacheWrap

CacheWrapWithTrace implements the KVStore interface. It panics as a TraceKVStore cannot be cache wrapped.

func (*TraceKVStore) Delete

func (tkv *TraceKVStore) Delete(key []byte)

Delete implements the KVStore interface. It traces a write operation and delegates the Delete call to the parent KVStore.

func (*TraceKVStore) Get

func (tkv *TraceKVStore) Get(key []byte) []byte

Get implements the KVStore interface. It traces a read operation and delegates a Get call to the parent KVStore.

func (*TraceKVStore) GetStoreType

func (tkv *TraceKVStore) GetStoreType() sdk.StoreType

GetStoreType implements the KVStore interface. It returns the underlying KVStore type.

func (*TraceKVStore) Has

func (tkv *TraceKVStore) Has(key []byte) bool

Has implements the KVStore interface. It delegates the Has call to the parent KVStore.

func (*TraceKVStore) Iterator

func (tkv *TraceKVStore) Iterator(start, end []byte) sdk.Iterator

Iterator implements the KVStore interface. It delegates the Iterator call the to the parent KVStore.

func (*TraceKVStore) Prefix

func (tkv *TraceKVStore) Prefix(prefix []byte) KVStore

Prefix implements the KVStore interface.

func (*TraceKVStore) ReverseIterator

func (tkv *TraceKVStore) ReverseIterator(start, end []byte) sdk.Iterator

ReverseIterator implements the KVStore interface. It delegates the ReverseIterator call the to the parent KVStore.

func (*TraceKVStore) Set

func (tkv *TraceKVStore) Set(key []byte, value []byte)

Set implements the KVStore interface. It traces a write operation and delegates the Set call to the parent KVStore.

type TreeStore

type TreeStore = types.TreeStore

Import cosmos-sdk/types/store.go for convenience. nolint

Jump to

Keyboard shortcuts

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