github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/store/rootmulti/dbadapter.go (about) 1 package rootmulti 2 3 import ( 4 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/store/dbadapter" 5 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/store/types" 6 "github.com/fibonacci-chain/fbc/libs/iavl" 7 ) 8 9 var commithash = []byte("FAKE_HASH") 10 11 //---------------------------------------- 12 // commitDBStoreWrapper should only be used for simulation/debugging, 13 // as it doesn't compute any commit hash, and it cannot load older state. 14 15 // Wrapper type for dbm.Db with implementation of KVStore 16 type commitDBStoreAdapter struct { 17 dbadapter.Store 18 } 19 20 func (cdsa commitDBStoreAdapter) Commit(*iavl.TreeDelta, []byte) (types.CommitID, iavl.TreeDelta, []byte) { 21 return types.CommitID{ 22 Version: -1, 23 Hash: commithash, 24 }, iavl.TreeDelta{}, nil 25 } 26 27 func (cdsa commitDBStoreAdapter) CommitterCommit(*iavl.TreeDelta) (types.CommitID, *iavl.TreeDelta) { 28 return types.CommitID{ 29 Version: -1, 30 Hash: commithash, 31 }, &iavl.TreeDelta{} 32 } 33 34 func (cdsa commitDBStoreAdapter) LastCommitID() types.CommitID { 35 return types.CommitID{ 36 Version: -1, 37 Hash: commithash, 38 } 39 } 40 41 func (cdsa commitDBStoreAdapter) LastCommitVersion() (v int64) { 42 return -1 43 } 44 45 func (cdsa commitDBStoreAdapter) SetPruning(_ types.PruningOptions) {} 46 47 func (cdsa commitDBStoreAdapter) GetDBReadTime() int { return 0 } 48 func (cdsa commitDBStoreAdapter) GetDBWriteCount() int { return 0 } 49 50 func (cdsa commitDBStoreAdapter) GetDBReadCount() int { return 0 } 51 func (cdsa commitDBStoreAdapter) GetNodeReadCount() int { return 0 } 52 53 func (cdsa commitDBStoreAdapter) ResetCount() {} 54 55 func (cdsa commitDBStoreAdapter) GetFlatKVReadTime() int { return 0 } 56 func (cdsa commitDBStoreAdapter) GetFlatKVWriteTime() int { return 0 } 57 func (cdsa commitDBStoreAdapter) GetFlatKVReadCount() int { return 0 } 58 func (cdsa commitDBStoreAdapter) GetFlatKVWriteCount() int { return 0 } 59 func (cdsa commitDBStoreAdapter) SetUpgradeVersion(int64) {}