Merged
Conversation
…another. Optimal migration path detection
krisbitney
suggested changes
Sep 30, 2022
packages/js/manifests/polywrap/src/migrations/findShortestMigrationPath.ts
Show resolved
Hide resolved
Contributor
|
Amazing work 🔥. This will be really helpful. Much better than the whole "exponentially increasing number of migrator implementations" situation! |
nerfZael
approved these changes
Sep 30, 2022
krisbitney
approved these changes
Oct 1, 2022
Contributor
|
P.S. the |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #1211
This PR introduces a developer-defined collection of Migrators, which are simple objects that describe migrations from one version of a manifest format to another.
Now, devs can define both up and down migrations, and adding a new version of a certain manifest will require writing only one migration.
Small implementation detail:
Under the assumption that all migrations have the same "level of complexity", a simple "migration graph" is traversed using BFS and the shortest migration path is returned (or
undefinedif none is found). See issue #1211 for examples.Possible future work:
polywrap manifest migrateCLI command could now have an additional optional parameter-f, --formatwherein the user could specify to which format they want to migrate, the default being the latest format. Create an issue if people agree.