Skip to content

Commit

Permalink
Support namespacing within RMS db
Browse files Browse the repository at this point in the history
  • Loading branch information
jaekwon committed Apr 12, 2018
1 parent 3f2a8e7 commit 5883c0e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions store/rootmultistore.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ func (rs *rootMultiStore) MountStoreWithDB(key StoreKey, typ StoreType, db dbm.D
panic(fmt.Sprintf("rootMultiStore duplicate store key %v", key))
}
rs.storesParams[key] = storeParams{
db: db,
key: key,
typ: typ,
db: db,
}
rs.keysByName[key.Name()] = key
}
Expand Down Expand Up @@ -244,9 +245,12 @@ func parsePath(path string) (storeName string, subpath string, err sdk.Error) {
//----------------------------------------

func (rs *rootMultiStore) loadCommitStoreFromParams(id CommitID, params storeParams) (store CommitStore, err error) {
db := rs.db
var db dbm.DB
if params.db != nil {
db = params.db
} else {
db = rs.db
db = dbm.NewPrefixDB(rs.db, []byte(params.key.Name()))
}
switch params.typ {
case sdk.StoreTypeMulti:
Expand Down Expand Up @@ -276,6 +280,7 @@ func (rs *rootMultiStore) nameToKey(name string) StoreKey {
// storeParams

type storeParams struct {
key StoreKey
db dbm.DB
typ StoreType
}
Expand Down

0 comments on commit 5883c0e

Please sign in to comment.