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