cosmos-sdk/store/storage/database.go
Aleksandr Bezobchuk 20b1da7a2e
refactor(store/v2): Use Core Iterator (#18957)
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
Co-authored-by: cool-developer <51834436+cool-develope@users.noreply.github.com>
2024-01-08 19:26:10 +00:00

27 lines
818 B
Go

package storage
import (
"io"
corestore "cosmossdk.io/core/store"
"cosmossdk.io/store/v2"
)
// Database is an interface that wraps the storage database methods. A wrapper
// is useful for instances where you want to perform logic that is identical for all SS
// backends, such as restoring snapshots.
type Database interface {
NewBatch(version uint64) (store.Batch, error)
Has(storeKey string, version uint64, key []byte) (bool, error)
Get(storeKey string, version uint64, key []byte) ([]byte, error)
GetLatestVersion() (uint64, error)
SetLatestVersion(version uint64) error
Iterator(storeKey string, version uint64, start, end []byte) (corestore.Iterator, error)
ReverseIterator(storeKey string, version uint64, start, end []byte) (corestore.Iterator, error)
Prune(version uint64) error
io.Closer
}