Skip to content

Commit

Permalink
conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Aug 13, 2024
1 parent f705584 commit 563b06e
Showing 1 changed file with 6 additions and 45 deletions.
51 changes: 6 additions & 45 deletions tools/confix/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,65 +21,26 @@ type MigrationMap map[string]func(from *tomledit.Document, to string) transform.

// loadDestConfigFile is the function signature to load the destination version
// configuration toml file.
type loadDestConfigFile func(to, planType string) (*tomledit.Document, error)
type loadDestConfigFile func(to string) (*tomledit.Document, error)

var Migrations = MigrationMap{
"v0.45": NoPlan, // Confix supports only the current supported SDK version. So we do not support v0.44 -> v0.45.
<<<<<<< HEAD
"v0.46": PlanBuilder,
"v0.47": PlanBuilder,
"v0.50": PlanBuilder,
// "v0.xx.x": PlanBuilder, // add specific migration in case of configuration changes in minor versions
}

// PlanBuilder is a function that returns a transformation plan for a given diff between two files.
func PlanBuilder(from *tomledit.Document, to string) transform.Plan {
plan := transform.Plan{}
deletedSections := map[string]bool{}

target, err := LoadLocalConfig(to)
=======
"v0.46": defaultPlanBuilder,
"v0.47": defaultPlanBuilder,
"v0.50": defaultPlanBuilder,
"v0.52": defaultPlanBuilder,
"v2": V2PlanBuilder,
// "v0.xx.x": defaultPlanBuilder, // add specific migration in case of configuration changes in minor versions
}

type v2KeyChangesMap map[string][]string

// list all the keys which are need to be modified in v2
var v2KeyChanges = v2KeyChangesMap{
"min-retain-blocks": []string{"comet.min-retain-blocks"},
"index-events": []string{"comet.index-events"},
"halt-height": []string{"comet.halt-height"},
"halt-time": []string{"comet.halt-time"},
"app-db-backend": []string{"store.app-db-backend"},
"pruning-keep-recent": []string{
"store.options.ss-pruning-option.keep-recent",
"store.options.sc-pruning-option.keep-recent",
},
"pruning-interval": []string{
"store.options.ss-pruning-option.interval",
"store.options.sc-pruning-option.interval",
},
"iavl-cache-size": []string{"store.options.iavl-config.cache-size"},
"iavl-disable-fastnode": []string{"store.options.iavl-config.skip-fast-storage-upgrade"},
// Add other key mappings as needed
// "v0.xx.x": PlanBuilder, // add specific migration in case of configuration changes in minor versions
}

func defaultPlanBuilder(from *tomledit.Document, to, planType string) (transform.Plan, *tomledit.Document) {
return PlanBuilder(from, to, planType, LoadLocalConfig)
func defaultPlanBuilder(from *tomledit.Document, to string) transform.Plan {
return PlanBuilder(from, to, LoadLocalConfig)
}

// PlanBuilder is a function that returns a transformation plan for a given diff between two files.
func PlanBuilder(from *tomledit.Document, to, planType string, loadFn loadDestConfigFile) (transform.Plan, *tomledit.Document) {
func PlanBuilder(from *tomledit.Document, to string, loadFn loadDestConfigFile) transform.Plan {
plan := transform.Plan{}
deletedSections := map[string]bool{}

target, err := loadFn(to, planType)
>>>>>>> 1d7f891ea (feat(confix): allow customization of migration plan (#21202))
target, err := loadFn(to)
if err != nil {
panic(fmt.Errorf("failed to parse file: %w. This file should have been valid", err))
}
Expand Down

0 comments on commit 563b06e

Please sign in to comment.