Fixing store/* bugs...
This commit is contained in:
parent
0917fc3de7
commit
1d207a2a5e
|
@ -12,7 +12,6 @@ import (
|
||||||
"github.com/tendermint/tmlibs/log"
|
"github.com/tendermint/tmlibs/log"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk"
|
sdk "github.com/cosmos/cosmos-sdk"
|
||||||
"github.com/cosmos/cosmos-sdk/util"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const mainKeyHeader = "header"
|
const mainKeyHeader = "header"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package client
|
package client
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
@ -25,3 +27,4 @@ func GetKeyManager(rootDir string) keys.Manager {
|
||||||
)
|
)
|
||||||
return manager
|
return manager
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -128,9 +128,6 @@ imports:
|
||||||
subpackages:
|
subpackages:
|
||||||
- bcrypt
|
- bcrypt
|
||||||
- keys
|
- keys
|
||||||
- keys/cryptostore
|
|
||||||
- keys/storage/filestorage
|
|
||||||
- keys/storage/memstorage
|
|
||||||
- keys/wordlist
|
- keys/wordlist
|
||||||
- nano
|
- nano
|
||||||
- name: github.com/tendermint/go-wire
|
- name: github.com/tendermint/go-wire
|
||||||
|
@ -139,7 +136,7 @@ imports:
|
||||||
- data
|
- data
|
||||||
- data/base58
|
- data/base58
|
||||||
- name: github.com/tendermint/iavl
|
- name: github.com/tendermint/iavl
|
||||||
version: 595f3dcd5b6cd4a292e90757ae6d367fd7a6e653
|
version: 7198bc18ac0cf4ac0f57802d8022695640b79ec7
|
||||||
- name: github.com/tendermint/light-client
|
- name: github.com/tendermint/light-client
|
||||||
version: 76313d625e662ed7b284d066d68ff71edd7a9fac
|
version: 76313d625e662ed7b284d066d68ff71edd7a9fac
|
||||||
subpackages:
|
subpackages:
|
||||||
|
@ -177,7 +174,7 @@ imports:
|
||||||
- types
|
- types
|
||||||
- version
|
- version
|
||||||
- name: github.com/tendermint/tmlibs
|
- name: github.com/tendermint/tmlibs
|
||||||
version: 0a652499ead7cd20a57a6a592f0491a2b493bb85
|
version: 17dc8a74497d3fee933592ef860275e6b0dd71d6
|
||||||
subpackages:
|
subpackages:
|
||||||
- autofile
|
- autofile
|
||||||
- cli
|
- cli
|
||||||
|
|
|
@ -8,18 +8,31 @@ import dbm "github.com/tendermint/tmlibs/db"
|
||||||
// cacheMultiStore holds many cache-wrapped stores.
|
// cacheMultiStore holds many cache-wrapped stores.
|
||||||
// Implements MultiStore.
|
// Implements MultiStore.
|
||||||
type cacheMultiStore struct {
|
type cacheMultiStore struct {
|
||||||
db dbm.DB
|
db dbm.CacheDB
|
||||||
version int64
|
curVersion int64
|
||||||
lastCommitID CommitID
|
lastCommitID CommitID
|
||||||
substores map[string]CacheWriter
|
substores map[string]CacheWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCacheMultiStore(rs *rootMultiStore) cacheMultiStore {
|
func newCacheMultiStoreFromRMS(rms *rootMultiStore) cacheMultiStore {
|
||||||
cms := cacheMultiStore{
|
cms := cacheMultiStore{
|
||||||
db: rs.db.CacheDB(),
|
db: rms.db.CacheDB(),
|
||||||
version: rs.curVersion,
|
curVersion: rms.curVersion,
|
||||||
lastCommitID: rs.lastCommitID,
|
lastCommitID: rms.lastCommitID,
|
||||||
substores: make(map[string]CacheWriter, len(rs.substores)),
|
substores: make(map[string]CacheWriter, len(rms.substores)),
|
||||||
|
}
|
||||||
|
for name, substore := range rms.substores {
|
||||||
|
cms.substores[name] = substore.CacheWrap().(CacheWriter)
|
||||||
|
}
|
||||||
|
return cms
|
||||||
|
}
|
||||||
|
|
||||||
|
func newCacheMultiStoreFromCMS(cms cacheMultiStore) cacheMultiStore {
|
||||||
|
cms := cacheMultiStore{
|
||||||
|
db: cms.db.CacheDB(),
|
||||||
|
curVersion: cms.curVersion,
|
||||||
|
lastCommitID: cms.lastCommitID,
|
||||||
|
substores: make(map[string]CacheWriter, len(cms.substores)),
|
||||||
}
|
}
|
||||||
for name, substore := range rs.substores {
|
for name, substore := range rs.substores {
|
||||||
cms.substores[name] = substore.CacheWrap().(CacheWriter)
|
cms.substores[name] = substore.CacheWrap().(CacheWriter)
|
||||||
|
@ -34,33 +47,33 @@ func (cms cacheMultiStore) LastCommitID() CommitID {
|
||||||
|
|
||||||
// Implements CacheMultiStore
|
// Implements CacheMultiStore
|
||||||
func (cms cacheMultiStore) CurrentVersion() int64 {
|
func (cms cacheMultiStore) CurrentVersion() int64 {
|
||||||
return cms.version
|
return cms.curVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements CacheMultiStore
|
// Implements CacheMultiStore
|
||||||
func (cms cacheMultiStore) Write() {
|
func (cms cacheMultiStore) Write() {
|
||||||
cms.db.Write()
|
cms.db.Write()
|
||||||
for substore := range cms.substores {
|
for _, substore := range cms.substores {
|
||||||
substore.Write()
|
substore.Write()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements CacheMultiStore
|
// Implements CacheMultiStore
|
||||||
func (rs cacheMultiStore) CacheMultiStore() CacheMultiStore {
|
func (cms cacheMultiStore) CacheMultiStore() CacheMultiStore {
|
||||||
return newCacheMultiStore(rs)
|
return newCacheMultiStoreFromCMS(cms)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements CacheMultiStore
|
// Implements CacheMultiStore
|
||||||
func (rs cacheMultiStore) GetCommitter(name string) Committer {
|
func (cms cacheMultiStore) GetCommitter(name string) Committer {
|
||||||
return rs.store[name]
|
return cms.store[name]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements CacheMultiStore
|
// Implements CacheMultiStore
|
||||||
func (rs cacheMultiStore) GetKVStore(name string) KVStore {
|
func (cms cacheMultiStore) GetKVStore(name string) KVStore {
|
||||||
return rs.store[name].(KVStore)
|
return cms.store[name].(KVStore)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements CacheMultiStore
|
// Implements CacheMultiStore
|
||||||
func (rs cacheMultiStore) GetIterKVStore(name string) IterKVStore {
|
func (cms cacheMultiStore) GetIterKVStore(name string) IterKVStore {
|
||||||
return rs.store[name].(IterKVStore)
|
return cms.store[name].(IterKVStore)
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ func (rs *rootMultiStore) LastCommitID() CommitID {
|
||||||
|
|
||||||
// Implements MultiStore
|
// Implements MultiStore
|
||||||
func (rs *rootMultiStore) CacheMultiStore() CacheMultiStore {
|
func (rs *rootMultiStore) CacheMultiStore() CacheMultiStore {
|
||||||
return newCacheMultiStore(rs)
|
return newCacheMultiStoreFromRMS(rs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements MultiStore
|
// Implements MultiStore
|
||||||
|
|
Loading…
Reference in New Issue