github.com/Finschia/finschia-sdk@v0.48.1/store/transient/store.go (about)

     1  package transient
     2  
     3  import (
     4  	dbm "github.com/tendermint/tm-db"
     5  
     6  	"github.com/Finschia/finschia-sdk/store/dbadapter"
     7  	"github.com/Finschia/finschia-sdk/store/types"
     8  )
     9  
    10  var (
    11  	_ types.Committer = (*Store)(nil)
    12  	_ types.KVStore   = (*Store)(nil)
    13  )
    14  
    15  // Store is a wrapper for a dbm with Commiter implementation
    16  type Store struct {
    17  	dbadapter.Store
    18  }
    19  
    20  // Constructs new dbm adapter
    21  func NewStore() *Store {
    22  	return &Store{Store: dbadapter.Store{DB: dbm.NewMemDB()}}
    23  }
    24  
    25  // Implements CommitStore
    26  // Commit cleans up Store.
    27  func (ts *Store) Commit() (id types.CommitID) {
    28  	ts.Store = dbadapter.Store{DB: dbm.NewMemDB()}
    29  	return
    30  }
    31  
    32  func (ts *Store) SetPruning(_ types.PruningOptions) {}
    33  
    34  // GetPruning is a no-op as pruning options cannot be directly set on this store.
    35  // They must be set on the root commit multi-store.
    36  func (ts *Store) GetPruning() types.PruningOptions { return types.PruningOptions{} }
    37  
    38  // Implements CommitStore
    39  func (ts *Store) LastCommitID() (id types.CommitID) {
    40  	return
    41  }
    42  
    43  // Implements Store.
    44  func (ts *Store) GetStoreType() types.StoreType {
    45  	return types.StoreTypeTransient
    46  }