github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/store/transient/transient_store.go (about)

     1  package transient
     2  
     3  import (
     4  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/store/types"
     5  	"github.com/fibonacci-chain/fbc/libs/iavl"
     6  	dbm "github.com/fibonacci-chain/fbc/libs/tm-db"
     7  
     8  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/store/dbadapter"
     9  )
    10  
    11  var _ types.Committer = (*Store)(nil)
    12  var _ types.KVStore = (*Store)(nil)
    13  
    14  // Store is a wrapper for a MemDB with Commiter implementation
    15  type Store struct {
    16  	dbadapter.Store
    17  }
    18  
    19  // Constructs new MemDB adapter
    20  func NewStore() *Store {
    21  	return &Store{Store: dbadapter.Store{DB: dbm.NewMemDB()}}
    22  }
    23  
    24  // Implements CommitStore
    25  // Commit cleans up Store.
    26  func (ts *Store) Commit(*iavl.TreeDelta, []byte) (id types.CommitID, _ iavl.TreeDelta, _ []byte) {
    27  	ts.Store = dbadapter.Store{DB: dbm.NewMemDB()}
    28  	return
    29  }
    30  
    31  func (ts *Store) CommitterCommit(*iavl.TreeDelta) (id types.CommitID, _ *iavl.TreeDelta) {
    32  	ts.Store = dbadapter.Store{DB: dbm.NewMemDB()}
    33  	return
    34  }
    35  
    36  // Implements CommitStore
    37  func (ts *Store) SetPruning(pruning types.PruningOptions) {
    38  }
    39  
    40  // Implements CommitStore
    41  func (ts *Store) LastCommitID() (id types.CommitID) {
    42  	return
    43  }
    44  
    45  func (ts *Store) LastCommitVersion() (v int64) {
    46  	return
    47  }
    48  
    49  // Implements Store.
    50  func (ts *Store) GetStoreType() types.StoreType {
    51  	return types.StoreTypeTransient
    52  }
    53  
    54  func (ts *Store) GetDBWriteCount() int {
    55  	return 0
    56  }
    57  
    58  func (ts *Store) GetDBReadTime() int {
    59  	return 0
    60  }
    61  
    62  func (ts *Store) GetDBReadCount() int {
    63  	return 0
    64  }
    65  func (ts *Store) GetNodeReadCount() int {
    66  	return 0
    67  }
    68  
    69  func (ts *Store) ResetCount() {
    70  }
    71  
    72  func (ts *Store) GetFlatKVReadTime() int {
    73  	return 0
    74  }
    75  
    76  func (ts *Store) GetFlatKVWriteTime() int {
    77  	return 0
    78  }
    79  
    80  func (ts *Store) GetFlatKVReadCount() int {
    81  	return 0
    82  }
    83  
    84  func (ts *Store) GetFlatKVWriteCount() int {
    85  	return 0
    86  }
    87  
    88  func (ts *Store) SetUpgradeVersion(int64) {
    89  
    90  }