2018-03-19 06:01:49 -07:00
|
|
|
package mock
|
|
|
|
|
|
|
|
import (
|
2018-07-12 16:58:51 -07:00
|
|
|
"io"
|
|
|
|
|
2019-08-02 06:20:39 -07:00
|
|
|
dbm "github.com/tendermint/tm-db"
|
2018-03-19 06:01:49 -07:00
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
2018-03-19 06:01:49 -07:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
)
|
|
|
|
|
2018-07-26 18:24:18 -07:00
|
|
|
var _ sdk.MultiStore = multiStore{}
|
|
|
|
|
2018-03-19 06:01:49 -07:00
|
|
|
type multiStore struct {
|
2021-10-04 09:36:38 -07:00
|
|
|
kv map[storetypes.StoreKey]kvStore
|
2018-03-19 06:01:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (ms multiStore) CacheMultiStore() sdk.CacheMultiStore {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2019-09-17 09:13:26 -07:00
|
|
|
func (ms multiStore) CacheMultiStoreWithVersion(_ int64) (sdk.CacheMultiStore, error) {
|
2019-05-28 17:58:33 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (ms multiStore) CacheWrap() storetypes.CacheWrap {
|
2018-03-19 06:01:49 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (ms multiStore) CacheWrapWithTrace(_ io.Writer, _ sdk.TraceContext) storetypes.CacheWrap {
|
2018-07-12 16:58:51 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (ms multiStore) CacheWrapWithListeners(_ storetypes.StoreKey, _ []storetypes.WriteListener) storetypes.CacheWrap {
|
2021-03-30 13:13:51 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2018-07-12 16:58:51 -07:00
|
|
|
func (ms multiStore) TracingEnabled() bool {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2019-02-01 17:03:09 -08:00
|
|
|
func (ms multiStore) SetTracingContext(tc sdk.TraceContext) sdk.MultiStore {
|
2018-07-12 16:58:51 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2019-02-01 17:03:09 -08:00
|
|
|
func (ms multiStore) SetTracer(w io.Writer) sdk.MultiStore {
|
2018-07-12 16:58:51 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (ms multiStore) AddListeners(key storetypes.StoreKey, listeners []storetypes.WriteListener) {
|
2021-03-30 13:13:51 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (ms multiStore) ListeningEnabled(key storetypes.StoreKey) bool {
|
2021-03-30 13:13:51 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (ms multiStore) Commit() storetypes.CommitID {
|
2018-03-19 06:01:49 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (ms multiStore) LastCommitID() storetypes.CommitID {
|
2018-03-19 06:01:49 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2019-01-09 07:06:22 -08:00
|
|
|
func (ms multiStore) SetPruning(opts sdk.PruningOptions) {
|
2018-07-12 18:20:26 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2020-09-14 07:12:49 -07:00
|
|
|
func (ms multiStore) GetPruning() sdk.PruningOptions {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (ms multiStore) GetCommitKVStore(key storetypes.StoreKey) storetypes.CommitKVStore {
|
2018-03-19 06:01:49 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (ms multiStore) GetCommitStore(key storetypes.StoreKey) storetypes.CommitStore {
|
2018-03-19 06:01:49 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (ms multiStore) MountStoreWithDB(key storetypes.StoreKey, typ storetypes.StoreType, db dbm.DB) {
|
2018-03-19 06:01:49 -07:00
|
|
|
ms.kv[key] = kvStore{store: make(map[string][]byte)}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ms multiStore) LoadLatestVersion() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (ms multiStore) LoadLatestVersionAndUpgrade(upgrades *storetypes.StoreUpgrades) error {
|
2019-08-06 05:59:22 -07:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (ms multiStore) LoadVersionAndUpgrade(ver int64, upgrades *storetypes.StoreUpgrades) error {
|
2019-08-06 05:59:22 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2018-04-25 05:45:22 -07:00
|
|
|
func (ms multiStore) LoadVersion(ver int64) error {
|
2018-03-19 06:01:49 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (ms multiStore) GetKVStore(key storetypes.StoreKey) sdk.KVStore {
|
2018-03-19 06:01:49 -07:00
|
|
|
return ms.kv[key]
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (ms multiStore) GetStore(key storetypes.StoreKey) sdk.Store {
|
2018-03-19 06:01:49 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (ms multiStore) GetStoreType() storetypes.StoreType {
|
2018-03-19 06:01:49 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2019-09-04 10:33:32 -07:00
|
|
|
func (ms multiStore) SetInterBlockCache(_ sdk.MultiStorePersistentCache) {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2020-09-03 03:11:46 -07:00
|
|
|
func (ms multiStore) SetInitialVersion(version int64) error {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2020-09-08 02:05:44 -07:00
|
|
|
func (ms multiStore) Snapshot(height uint64, format uint32) (<-chan io.ReadCloser, error) {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ms multiStore) Restore(
|
|
|
|
height uint64, format uint32, chunks <-chan io.ReadCloser, ready chan<- struct{},
|
|
|
|
) error {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2018-07-26 18:24:18 -07:00
|
|
|
var _ sdk.KVStore = kvStore{}
|
|
|
|
|
2018-03-19 06:01:49 -07:00
|
|
|
type kvStore struct {
|
|
|
|
store map[string][]byte
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (kv kvStore) CacheWrap() storetypes.CacheWrap {
|
2018-03-19 06:01:49 -07:00
|
|
|
panic("not implemented")
|
2018-07-12 16:58:51 -07:00
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (kv kvStore) CacheWrapWithTrace(w io.Writer, tc sdk.TraceContext) storetypes.CacheWrap {
|
2018-07-12 16:58:51 -07:00
|
|
|
panic("not implemented")
|
2018-03-19 06:01:49 -07:00
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (kv kvStore) CacheWrapWithListeners(_ storetypes.StoreKey, _ []storetypes.WriteListener) storetypes.CacheWrap {
|
2021-03-30 13:13:51 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2021-10-04 09:36:38 -07:00
|
|
|
func (kv kvStore) GetStoreType() storetypes.StoreType {
|
2018-03-19 06:01:49 -07:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (kv kvStore) Get(key []byte) []byte {
|
|
|
|
v, ok := kv.store[string(key)]
|
|
|
|
if !ok {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return v
|
|
|
|
}
|
|
|
|
|
|
|
|
func (kv kvStore) Has(key []byte) bool {
|
|
|
|
_, ok := kv.store[string(key)]
|
|
|
|
return ok
|
|
|
|
}
|
|
|
|
|
|
|
|
func (kv kvStore) Set(key, value []byte) {
|
2021-10-04 09:36:38 -07:00
|
|
|
storetypes.AssertValidKey(key)
|
2018-03-19 06:01:49 -07:00
|
|
|
kv.store[string(key)] = value
|
|
|
|
}
|
|
|
|
|
|
|
|
func (kv kvStore) Delete(key []byte) {
|
|
|
|
delete(kv.store, string(key))
|
|
|
|
}
|
|
|
|
|
2018-06-21 14:33:36 -07:00
|
|
|
func (kv kvStore) Prefix(prefix []byte) sdk.KVStore {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2018-07-26 18:24:18 -07:00
|
|
|
func (kv kvStore) Gas(meter sdk.GasMeter, config sdk.GasConfig) sdk.KVStore {
|
|
|
|
panic("not implmeneted")
|
|
|
|
}
|
|
|
|
|
2018-03-19 06:01:49 -07:00
|
|
|
func (kv kvStore) Iterator(start, end []byte) sdk.Iterator {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (kv kvStore) ReverseIterator(start, end []byte) sdk.Iterator {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2018-04-12 06:59:24 -07:00
|
|
|
func (kv kvStore) SubspaceIterator(prefix []byte) sdk.Iterator {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (kv kvStore) ReverseSubspaceIterator(prefix []byte) sdk.Iterator {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2018-06-29 15:22:24 -07:00
|
|
|
func NewCommitMultiStore() sdk.CommitMultiStore {
|
2021-10-04 09:36:38 -07:00
|
|
|
return multiStore{kv: make(map[storetypes.StoreKey]kvStore)}
|
2018-03-19 06:01:49 -07:00
|
|
|
}
|