Skip to content

Commit

Permalink
feat(store): Add snapshot manager Close method (#17294)
Browse files Browse the repository at this point in the history
Co-authored-by: Julien Robert <[email protected]>
  • Loading branch information
chillyvee and julienrbrt authored Aug 6, 2023
1 parent 213ddf7 commit 6a76448
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions store/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

## [Unreleased]

### Features

* [#17294](https://github.com/cosmos/cosmos-sdk/pull/17294) Add snapshot manager Close method.

### Improvements

* [#17158](https://github.com/cosmos/cosmos-sdk/pull/17158) Start the goroutine after need to create a snapshot.
Expand Down
6 changes: 6 additions & 0 deletions store/snapshots/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,3 +551,9 @@ func (m *Manager) snapshot(height int64) {
m.logger.Debug("pruned state snapshots", "pruned", pruned)
}
}

// Close the snapshot database.
func (m *Manager) Close() error {
m.logger.Info("snapshotManager Close Database")
return m.store.db.Close()
}
2 changes: 2 additions & 0 deletions store/snapshots/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func TestManager_List(t *testing.T) {
list, err := manager.List()
require.NoError(t, err)
assert.Equal(t, []*types.Snapshot{}, list)

require.NoError(t, manager.Close())
}

func TestManager_LoadChunk(t *testing.T) {
Expand Down

0 comments on commit 6a76448

Please sign in to comment.