-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move
serve_journal
into upgrade_journal.rs (#3393)
## What `serve_journal` is moved into `upgrade_journal.rs` within SNS Governance. Previously it was located in `ic-nervous-system-common` ## Why 1. `serve_journal` was only used by SNS Governance, so it didn't really need to be in ic-nervous-system-common. I think it was there because that's also where `serve_logs` was. If there was another reason, please let me know. 2. `serve_journal` a somewhat dangerous function because it is generic. It takes anything that implements Serialize. I think this was done because no function in `ic-nervous-system-common` can take `UpgradeJournal` because that would require depending on `ic-sns-governance` which would introduce a circular dependency. But the function being generic is dangerous. We really only want to serve the journal with this function, not any other type. This would normally not be a problem, because what else are you going to pass to `serve_journal` besides the journal? But now we have two types named journal: the one in `ic-sns-governance` and `ic-sns-governance-api`. And you really want to serialize the `ic-sns-governance-api` one, because that's the one that has the manual `Serialize` implementation on it that leads to the journal having a user-friendly output. By moving the function into `ic-sns-governance`, we're able to make it not-generic, and depend on only one type. Then there's no chance that it will be called incorrect. For convenience, I made the function take a `ic-sns-governance` `UpgradeJournal` and do the conversion to the `ic-sns-governance-api` `UpgradeJournal` itself. This simplifies its usage at the call site In the next PR, I'm moving some things around, and this change is very useful to make sure we're passing right thing to serve_journal. [Next PR →](#3391)
- Loading branch information
Showing
7 changed files
with
41 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters