feat!: Add hooks to allow app modules to add things to state-sync (#10961)
## Description Closes: #7340 - Support registering multiple snapshotters in snapshot manager. - Append the extension snapshotters to existing snapshot stream. ~TODO: testing.~ - existing tests are fixed --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
This commit is contained in:
@@ -260,6 +260,22 @@ func DefaultStoreLoader(ms sdk.CommitMultiStore) error {
|
||||
return ms.LoadLatestVersion()
|
||||
}
|
||||
|
||||
// CommitMultiStore returns the root multi-store.
|
||||
// App constructor can use this to access the `cms`.
|
||||
// UNSAFE: only safe to use during app initialization.
|
||||
func (app *BaseApp) CommitMultiStore() sdk.CommitMultiStore {
|
||||
if app.sealed {
|
||||
panic("cannot call CommitMultiStore() after baseapp is sealed")
|
||||
}
|
||||
return app.cms
|
||||
}
|
||||
|
||||
// SnapshotManager returns the snapshot manager.
|
||||
// application use this to register extra extension snapshotters.
|
||||
func (app *BaseApp) SnapshotManager() *snapshots.Manager {
|
||||
return app.snapshotManager
|
||||
}
|
||||
|
||||
// LoadVersion loads the BaseApp application version. It will panic if called
|
||||
// more than once on a running baseapp.
|
||||
func (app *BaseApp) LoadVersion(version int64) error {
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@ func (app *BaseApp) SetSnapshotStore(snapshotStore *snapshots.Store) {
|
||||
app.snapshotManager = nil
|
||||
return
|
||||
}
|
||||
app.snapshotManager = snapshots.NewManager(snapshotStore, app.cms)
|
||||
app.snapshotManager = snapshots.NewManager(snapshotStore, app.cms, nil)
|
||||
}
|
||||
|
||||
// SetSnapshotInterval sets the snapshot interval.
|
||||
|
||||
Reference in New Issue
Block a user