snapshotkv

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store manages a stack of nested cache store to support the evm `StateDB`'s `Snapshot` and `RevertToSnapshot` methods.

func NewStore

func NewStore(store storetypes.CacheKVStore) *Store

NewStore creates a new Store object

func (*Store) Commit

func (cs *Store) Commit()

Commit commits all the cached stores from top to bottom in order and clears the cache stack by setting an empty slice of cache store.

func (*Store) CurrentStore

func (cs *Store) CurrentStore() storetypes.CacheKVStore

CurrentStore returns the top of cached store stack. If the stack is empty, returns the initial store.

func (*Store) RevertToSnapshot

func (cs *Store) RevertToSnapshot(target int)

RevertToSnapshot pops all the cached stores whose index is greator than or equal to target. The target should be snapshot index returned by `Snapshot`. This function panics if the index is out of bounds.

func (*Store) Snapshot

func (cs *Store) Snapshot() int

Snapshot pushes a new cached store to the stack, and returns the index of it.

Jump to

Keyboard shortcuts

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