refactor: Remove store type aliases (#10295)
<!-- The default pull request template is for types feat, fix, or refactor. For other templates, add one of the following parameters to the url: - template=docs.md - template=other.md --> ## Description Closes: #9362 <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [X] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [X] added `!` to the type prefix if API or client breaking change - [X] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [X] provided a link to the relevant issue or specification - [X] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [X] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [X] added a changelog entry to `CHANGELOG.md` - [X] included comments for [documenting Go code](https://blog.golang.org/godoc) - [X] updated the relevant documentation or specification - [X] reviewed "Files changed" and left comments if necessary - [X] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
This commit is contained in:
+4
-4
@@ -6,14 +6,14 @@ import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/tendermint/tendermint/types"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
|
||||
bam "github.com/cosmos/cosmos-sdk/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/tx"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/middleware"
|
||||
@@ -72,7 +72,7 @@ func NewApp(rootDir string, logger log.Logger) (abci.Application, error) {
|
||||
|
||||
// KVStoreHandler is a simple handler that takes kvstoreTx and writes
|
||||
// them to the db
|
||||
func KVStoreHandler(storeKey sdk.StoreKey) sdk.Handler {
|
||||
func KVStoreHandler(storeKey storetypes.StoreKey) sdk.Handler {
|
||||
return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
|
||||
dTx, ok := msg.(kvstoreTx)
|
||||
if !ok {
|
||||
@@ -105,7 +105,7 @@ type GenesisJSON struct {
|
||||
|
||||
// InitChainer returns a function that can initialize the chain
|
||||
// with key/value pairs
|
||||
func InitChainer(key sdk.StoreKey) func(sdk.Context, abci.RequestInitChain) abci.ResponseInitChain {
|
||||
func InitChainer(key storetypes.StoreKey) func(sdk.Context, abci.RequestInitChain) abci.ResponseInitChain {
|
||||
return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
|
||||
stateJSON := req.AppStateBytes
|
||||
|
||||
|
||||
+23
-23
@@ -5,14 +5,14 @@ import (
|
||||
|
||||
dbm "github.com/tendermint/tm-db"
|
||||
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
var _ sdk.MultiStore = multiStore{}
|
||||
|
||||
type multiStore struct {
|
||||
kv map[sdk.StoreKey]kvStore
|
||||
kv map[storetypes.StoreKey]kvStore
|
||||
}
|
||||
|
||||
func (ms multiStore) CacheMultiStore() sdk.CacheMultiStore {
|
||||
@@ -23,15 +23,15 @@ func (ms multiStore) CacheMultiStoreWithVersion(_ int64) (sdk.CacheMultiStore, e
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (ms multiStore) CacheWrap() sdk.CacheWrap {
|
||||
func (ms multiStore) CacheWrap() storetypes.CacheWrap {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (ms multiStore) CacheWrapWithTrace(_ io.Writer, _ sdk.TraceContext) sdk.CacheWrap {
|
||||
func (ms multiStore) CacheWrapWithTrace(_ io.Writer, _ sdk.TraceContext) storetypes.CacheWrap {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (ms multiStore) CacheWrapWithListeners(_ store.StoreKey, _ []store.WriteListener) store.CacheWrap {
|
||||
func (ms multiStore) CacheWrapWithListeners(_ storetypes.StoreKey, _ []storetypes.WriteListener) storetypes.CacheWrap {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
@@ -47,19 +47,19 @@ func (ms multiStore) SetTracer(w io.Writer) sdk.MultiStore {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (ms multiStore) AddListeners(key store.StoreKey, listeners []store.WriteListener) {
|
||||
func (ms multiStore) AddListeners(key storetypes.StoreKey, listeners []storetypes.WriteListener) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (ms multiStore) ListeningEnabled(key store.StoreKey) bool {
|
||||
func (ms multiStore) ListeningEnabled(key storetypes.StoreKey) bool {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (ms multiStore) Commit() sdk.CommitID {
|
||||
func (ms multiStore) Commit() storetypes.CommitID {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (ms multiStore) LastCommitID() sdk.CommitID {
|
||||
func (ms multiStore) LastCommitID() storetypes.CommitID {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
@@ -71,15 +71,15 @@ func (ms multiStore) GetPruning() sdk.PruningOptions {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (ms multiStore) GetCommitKVStore(key sdk.StoreKey) sdk.CommitKVStore {
|
||||
func (ms multiStore) GetCommitKVStore(key storetypes.StoreKey) storetypes.CommitKVStore {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (ms multiStore) GetCommitStore(key sdk.StoreKey) sdk.CommitStore {
|
||||
func (ms multiStore) GetCommitStore(key storetypes.StoreKey) storetypes.CommitStore {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (ms multiStore) MountStoreWithDB(key sdk.StoreKey, typ sdk.StoreType, db dbm.DB) {
|
||||
func (ms multiStore) MountStoreWithDB(key storetypes.StoreKey, typ storetypes.StoreType, db dbm.DB) {
|
||||
ms.kv[key] = kvStore{store: make(map[string][]byte)}
|
||||
}
|
||||
|
||||
@@ -87,11 +87,11 @@ func (ms multiStore) LoadLatestVersion() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ms multiStore) LoadLatestVersionAndUpgrade(upgrades *store.StoreUpgrades) error {
|
||||
func (ms multiStore) LoadLatestVersionAndUpgrade(upgrades *storetypes.StoreUpgrades) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ms multiStore) LoadVersionAndUpgrade(ver int64, upgrades *store.StoreUpgrades) error {
|
||||
func (ms multiStore) LoadVersionAndUpgrade(ver int64, upgrades *storetypes.StoreUpgrades) error {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
@@ -99,15 +99,15 @@ func (ms multiStore) LoadVersion(ver int64) error {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (ms multiStore) GetKVStore(key sdk.StoreKey) sdk.KVStore {
|
||||
func (ms multiStore) GetKVStore(key storetypes.StoreKey) sdk.KVStore {
|
||||
return ms.kv[key]
|
||||
}
|
||||
|
||||
func (ms multiStore) GetStore(key sdk.StoreKey) sdk.Store {
|
||||
func (ms multiStore) GetStore(key storetypes.StoreKey) sdk.Store {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (ms multiStore) GetStoreType() sdk.StoreType {
|
||||
func (ms multiStore) GetStoreType() storetypes.StoreType {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
@@ -135,19 +135,19 @@ type kvStore struct {
|
||||
store map[string][]byte
|
||||
}
|
||||
|
||||
func (kv kvStore) CacheWrap() sdk.CacheWrap {
|
||||
func (kv kvStore) CacheWrap() storetypes.CacheWrap {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (kv kvStore) CacheWrapWithTrace(w io.Writer, tc sdk.TraceContext) sdk.CacheWrap {
|
||||
func (kv kvStore) CacheWrapWithTrace(w io.Writer, tc sdk.TraceContext) storetypes.CacheWrap {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (kv kvStore) CacheWrapWithListeners(_ store.StoreKey, _ []store.WriteListener) store.CacheWrap {
|
||||
func (kv kvStore) CacheWrapWithListeners(_ storetypes.StoreKey, _ []storetypes.WriteListener) storetypes.CacheWrap {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (kv kvStore) GetStoreType() sdk.StoreType {
|
||||
func (kv kvStore) GetStoreType() storetypes.StoreType {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ func (kv kvStore) Has(key []byte) bool {
|
||||
}
|
||||
|
||||
func (kv kvStore) Set(key, value []byte) {
|
||||
store.AssertValidKey(key)
|
||||
storetypes.AssertValidKey(key)
|
||||
kv.store[string(key)] = value
|
||||
}
|
||||
|
||||
@@ -198,5 +198,5 @@ func (kv kvStore) ReverseSubspaceIterator(prefix []byte) sdk.Iterator {
|
||||
}
|
||||
|
||||
func NewCommitMultiStore() sdk.CommitMultiStore {
|
||||
return multiStore{kv: make(map[sdk.StoreKey]kvStore)}
|
||||
return multiStore{kv: make(map[storetypes.StoreKey]kvStore)}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
dbm "github.com/tendermint/tm-db"
|
||||
|
||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ func TestStore(t *testing.T) {
|
||||
cms := NewCommitMultiStore()
|
||||
|
||||
key := sdk.NewKVStoreKey("test")
|
||||
cms.MountStoreWithDB(key, sdk.StoreTypeIAVL, db)
|
||||
cms.MountStoreWithDB(key, storetypes.StoreTypeIAVL, db)
|
||||
err := cms.LoadLatestVersion()
|
||||
require.Nil(t, err)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user