-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store Refactor #2986
Labels
Type: Code Hygiene
General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
Milestone
Comments
mossid
added
core
Type: Code Hygiene
General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
labels
Dec 3, 2018
Both of the first two PRs have been merged & we decided to leave the rest for post-launch. |
@mossid going to close this issue as complete based on the completed store refactors. If I'm incorrect please reopen this issue with the remaining work. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Type: Code Hygiene
General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
The
store/
is quite large and the parts are deeply interconnected with each other, so refactoring will be split into three parts:1. Move store types to separate folders #2309
Each store type, such as
rootmultistore.go
,iavlstore.go
, will be moved into separated folders, for example,rootmulti/store.go
,iavl/store.go
. Actual types will be namedStore
, making them exposed and easily accessible from external code - the caller can useiavl.Store
for example.We cannot use
KVStore.Gas()
andKVStore.Prefix()
now, since it causes import cycle betweenstore/prefix
andstore/gas
. For now we remove those methods and usegas.NewStore
andprefix.NewStore
directly.The dependency of
store
ontypes
will be inverted, meaning thattypes/store.go
,types/gas.go
,types/queryable.go
and part oftypes/errors.go
will be moved tostore/types/
, andtypes/store.go
will reexport them. But in the first PR, onlytypes/store.go
andtypes/gas.go
will be moved.WIP on #2985
2. Invert dependency
Because some of the error types are used by both
store/*
and the outside, we have to duplicate the error types fromtypes/
tostore/types/
. This PR will movetypes/errors.go
andtypes/queryable.go
tostore/types/
.3. Simplify store interfaces
Currently the interfaces in
types/store.go
have multiple layers of embedding which is hard to analyze. The second PR will simplify it to two-layer structure.It will also contain #2824. (Should it also be applied on
gas
?)Also, instead of using
StoreType
, which is an enum typerootmulti.Store
switches internally, we associate theStoreKey
andKVStore
/MultiStore
implementation so the multistore can also mount third-party store type (needs discussion).StoreKey
will be split intoKVStoreKey
andMultiStoreKey
, making it typesafe when accessing on substores and to prepare on future recursive multistore implementation.The primitive version can be found in #2344
The text was updated successfully, but these errors were encountered: