Add GetCommitKVStore and CommitKVStore

This commit is contained in:
Jae Kwon 2018-01-31 19:15:32 -08:00 committed by Ethan Buchman
parent 53812a2076
commit 7f4bcff3cf
4 changed files with 24 additions and 2 deletions

View File

@ -1,5 +1,12 @@
# Changelog # Changelog
## 0.11.0 (TBD)
BREAKING CHANGES
* [examples] dummy -> kvstore
* [types] CommitMultiStore interface has new `GetCommitKVStore(key StoreKey) CommitKVStore` method
## 0.10.0 (February 20, 2017) ## 0.10.0 (February 20, 2017)
BREAKING CHANGES BREAKING CHANGES

View File

@ -67,6 +67,11 @@ func (rs *rootMultiStore) GetCommitStore(key StoreKey) CommitStore {
return rs.stores[key] return rs.stores[key]
} }
// Implements CommitMultiStore.
func (rs *rootMultiStore) GetCommitKVStore(key StoreKey) CommitKVStore {
return rs.stores[key].(CommitKVStore)
}
// Implements CommitMultiStore. // Implements CommitMultiStore.
func (rs *rootMultiStore) LoadLatestVersion() error { func (rs *rootMultiStore) LoadLatestVersion() error {
ver := getLatestVersion(rs.db) ver := getLatestVersion(rs.db)

View File

@ -6,14 +6,15 @@ import (
// Import cosmos-sdk/types/store.go for convenience. // Import cosmos-sdk/types/store.go for convenience.
type Store = types.Store type Store = types.Store
type Committer = types.Committer
type CommitStore = types.CommitStore
type MultiStore = types.MultiStore type MultiStore = types.MultiStore
type CacheMultiStore = types.CacheMultiStore type CacheMultiStore = types.CacheMultiStore
type CommitStore = types.CommitStore
type Committer = types.Committer
type CommitMultiStore = types.CommitMultiStore type CommitMultiStore = types.CommitMultiStore
type KVStore = types.KVStore type KVStore = types.KVStore
type Iterator = types.Iterator type Iterator = types.Iterator
type CacheKVStore = types.CacheKVStore type CacheKVStore = types.CacheKVStore
type CommitKVStore = types.CommitKVStore
type CacheWrapper = types.CacheWrapper type CacheWrapper = types.CacheWrapper
type CacheWrap = types.CacheWrap type CacheWrap = types.CacheWrap
type CommitID = types.CommitID type CommitID = types.CommitID

View File

@ -68,6 +68,9 @@ type CommitMultiStore interface {
// Panics on a nil key. // Panics on a nil key.
GetCommitStore(key StoreKey) CommitStore GetCommitStore(key StoreKey) CommitStore
// Panics on a nil key.
GetCommitKVStore(key StoreKey) CommitKVStore
// Load the latest persisted version. Called once after all // Load the latest persisted version. Called once after all
// calls to Mount*Store() are complete. // calls to Mount*Store() are complete.
LoadLatestVersion() error LoadLatestVersion() error
@ -129,6 +132,12 @@ type CacheKVStore interface {
Write() Write()
} }
// Stores of MultiStore must implement CommitStore.
type CommitKVStore interface {
Committer
KVStore
}
//---------------------------------------- //----------------------------------------
// CacheWrap // CacheWrap