Refactored ContainerStorageManager for readability and manageability #1655
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issues: ContainerStorageManager has gotten very unwieldy with 1000+ LOC of highly complex and invocation-order dependent logic. It also does too much by trying to manage side inputs lifecycle along with regular state stores'.
Changes:
1. Separated side inputs (and standby) related store creation and restore logic into a separate SideInputsManager class.
2. Separated helper methods into a ContainerStorageManagerUtil class, and made them all static to ensure that they don't mutate class fields.
Most of the PR is simply moving code from one place to another. However a couple of places that introduce semantic changes or otherwise require careful review are called inline in "Refactor Note" comments.
There is a lot more room for improvement (e.g. more javadocs, more tests, simplifying method signatures, etc). But this change should make it easier to reason about the lifecycle of side inputs for now.
Tests: Existing ContainerStorageManager unit tests pass.