2019-02-01 17:03:09 -08:00
|
|
|
package transient
|
|
|
|
|
|
|
|
import (
|
2019-08-02 06:20:39 -07:00
|
|
|
dbm "github.com/tendermint/tm-db"
|
2019-02-01 17:03:09 -08:00
|
|
|
|
|
|
|
"github.com/cosmos/cosmos-sdk/store/dbadapter"
|
2020-04-16 08:10:39 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/store/types"
|
2019-02-01 17:03:09 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ types.Committer = (*Store)(nil)
|
|
|
|
var _ types.KVStore = (*Store)(nil)
|
|
|
|
|
|
|
|
// Store is a wrapper for a MemDB with Commiter implementation
|
|
|
|
type Store struct {
|
|
|
|
dbadapter.Store
|
|
|
|
}
|
|
|
|
|
|
|
|
// Constructs new MemDB adapter
|
|
|
|
func NewStore() *Store {
|
2019-08-19 09:06:27 -07:00
|
|
|
return &Store{Store: dbadapter.Store{DB: dbm.NewMemDB()}}
|
2019-02-01 17:03:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Implements CommitStore
|
|
|
|
// Commit cleans up Store.
|
|
|
|
func (ts *Store) Commit() (id types.CommitID) {
|
2019-08-19 09:06:27 -07:00
|
|
|
ts.Store = dbadapter.Store{DB: dbm.NewMemDB()}
|
2019-02-01 17:03:09 -08:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-09-14 07:12:49 -07:00
|
|
|
func (ts *Store) SetPruning(_ types.PruningOptions) {}
|
|
|
|
|
|
|
|
// GetPruning is a no-op as pruning options cannot be directly set on this store.
|
|
|
|
// They must be set on the root commit multi-store.
|
|
|
|
func (ts *Store) GetPruning() types.PruningOptions { return types.PruningOptions{} }
|
2019-02-01 17:03:09 -08:00
|
|
|
|
|
|
|
// Implements CommitStore
|
|
|
|
func (ts *Store) LastCommitID() (id types.CommitID) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Implements Store.
|
|
|
|
func (ts *Store) GetStoreType() types.StoreType {
|
|
|
|
return types.StoreTypeTransient
|
|
|
|
}
|