Skip to content

Commit

Permalink
add GetObjKVStore
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Jul 22, 2024
1 parent be52147 commit 45aa498
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions store/rootmulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,15 @@ func (rs *Store) GetKVStore(key types.StoreKey) types.KVStore {
return s
}

// GetObjKVStore returns a mounted ObjKVStore for a given StoreKey.
func (rs *Store) GetObjKVStore(key types.StoreKey) types.ObjKVStore {
s, ok := rs.GetStore(key).(types.ObjKVStore)
if !ok {
panic(fmt.Sprintf("store with key %v is not KVStore", key))
}
return s
}

// Implements interface MultiStore
func (rs *Store) TracingEnabled() bool {
return false
Expand Down
5 changes: 5 additions & 0 deletions versiondb/multistore.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ func (s *MultiStore) GetKVStore(storeKey types.StoreKey) types.KVStore {
return s.GetStore(storeKey).(types.KVStore)
}

// GetObjKVStore implements `MultiStore` interface
func (s *MultiStore) GetObjKVStore(storeKey types.StoreKey) types.ObjKVStore {
return s.GetStore(storeKey).(types.ObjKVStore)
}

// SetTracer sets the tracer for the MultiStore that the underlying
// stores will utilize to trace operations. A MultiStore is returned.
func (s *MultiStore) SetTracer(w io.Writer) types.MultiStore {
Expand Down

0 comments on commit 45aa498

Please sign in to comment.