forked from cosmos/cosmos-sdk
/
store.go
34 lines (26 loc) · 837 Bytes
/
store.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
package dbadapter
import (
"io"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/cosmos/cosmos-sdk/store/cachekv"
"github.com/cosmos/cosmos-sdk/store/tracekv"
"github.com/cosmos/cosmos-sdk/store/types"
)
// Wrapper type for dbm.Db with implementation of KVStore
type Store struct {
dbm.DB
}
// GetStoreType returns the type of the store.
func (Store) GetStoreType() types.StoreType {
return types.StoreTypeDB
}
// CacheWrap cache wraps the underlying store.
func (dsa Store) CacheWrap() types.CacheWrap {
return cachekv.NewStore(dsa)
}
// CacheWrapWithTrace implements KVStore.
func (dsa Store) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.CacheWrap {
return cachekv.NewStore(tracekv.NewStore(dsa, w, tc))
}
// dbm.DB implements KVStore so we can CacheKVStore it.
var _ types.KVStore = Store{}