Skip to content

Commit

Permalink
add Copy method to CacheKVStore interface
Browse files Browse the repository at this point in the history
  • Loading branch information
GAtom22 committed Jul 30, 2024
1 parent 8277a18 commit 772e967
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion store/cachekv/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (store *Store) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types
}

// Copy creates a deep copy of the Store object
func (store *Store) Copy() *Store {
func (store *Store) Copy() types.CacheKVStore {
store.mtx.Lock()
defer store.mtx.Unlock()

Expand Down
2 changes: 1 addition & 1 deletion store/cachemulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (cms Store) GetKVStore(key types.StoreKey) types.KVStore {
// Copy creates a deep copy of the Store object
func (cms Store) Copy() types.CacheMultiStore {
// Deep copy the db field
newDB := cms.db.(*cachekv.Store).Copy()
newDB := cms.db.Copy()

// Deep copy the cachekv stores map
newStores := make(map[types.StoreKey]types.CacheWrap, len(cms.stores))
Expand Down
1 change: 1 addition & 0 deletions store/types/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ type CacheKVStore interface {

// Writes operations to underlying KVStore
Write()
Copy() CacheKVStore
}

// CommitKVStore is an interface for MultiStore.
Expand Down

0 comments on commit 772e967

Please sign in to comment.