From 85fb444a1e0ea1c15dbd1080fe0ffa735810fc4e Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Tue, 14 Jan 2025 15:38:28 +0100 Subject: [PATCH] rename and update --- v2/migrate/main.go | 4 +- .../{v0/migrate_v0.go => v1/migrate.go} | 42 +++++++++---------- v2/migrate/{v0 => v1}/types.go | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) rename v2/migrate/{v0/migrate_v0.go => v1/migrate.go} (89%) rename v2/migrate/{v0 => v1}/types.go (99%) diff --git a/v2/migrate/main.go b/v2/migrate/main.go index 61c5c221f..ea58b93ec 100644 --- a/v2/migrate/main.go +++ b/v2/migrate/main.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - v0 "github.com/cosmos/iavl/v2/migrate/v0" + migratev1 "github.com/cosmos/iavl/v2/migrate/v1" "github.com/spf13/cobra" ) @@ -13,7 +13,7 @@ func main() { Use: "migrate", Short: "migrate application.db to IAVL v2", } - root.AddCommand(v0.Command()) + root.AddCommand(migratev1.Command()) if err := root.Execute(); err != nil { fmt.Printf("Error: %s\n", err.Error()) diff --git a/v2/migrate/v0/migrate_v0.go b/v2/migrate/v1/migrate.go similarity index 89% rename from v2/migrate/v0/migrate_v0.go rename to v2/migrate/v1/migrate.go index 9b305b738..53edcdf09 100644 --- a/v2/migrate/v0/migrate_v0.go +++ b/v2/migrate/v1/migrate.go @@ -1,4 +1,4 @@ -package v0 +package v1 import ( "bytes" @@ -16,8 +16,8 @@ import ( func Command() *cobra.Command { cmd := &cobra.Command{ - Use: "v0", - Short: "migrate latest iavl v0 application.db state to iavl v2 in sqlite", + Use: "v1", + Short: "migrate latest iavl v1 application.db state to iavl v2 in sqlite", } cmd.AddCommand(allCommand(), snapshotCommand(), metadataCommand(), latestVersionCommand()) return cmd @@ -31,16 +31,16 @@ const ( func metadataCommand() *cobra.Command { var ( - dbv0 string + dbv1 string dbv2 string ) cmd := &cobra.Command{ - Use: "v45-metadata", - Short: "migrate CosmosSDK v0.45 store metadata stored in application.db state to iavl v2 in sqlite", + Use: "v1-metadata", + Short: "migrate CosmosSDK v1 store metadata stored in application.db state to iavl v2 in sqlite", RunE: func(cmd *cobra.Command, args []string) error { log := logz.Logger.With().Str("op", "migrate").Logger() - v0, err := core.NewReadonlyStore(dbv0) + v0, err := core.NewReadonlyStore(dbv1) if err != nil { return err } @@ -86,9 +86,9 @@ func metadataCommand() *cobra.Command { }, } - cmd.Flags().StringVar(&dbv0, "db-v0", "", "Path to the v0 application.db") + cmd.Flags().StringVar(&dbv1, "db-v1", "", "Path to the v1 application.db") cmd.Flags().StringVar(&dbv2, "db-v2", "", "Path to the v2 root") - if err := cmd.MarkFlagRequired("db-v0"); err != nil { + if err := cmd.MarkFlagRequired("db-v1"); err != nil { panic(err) } if err := cmd.MarkFlagRequired("db-v2"); err != nil { @@ -142,16 +142,16 @@ func latestVersionCommand() *cobra.Command { func snapshotCommand() *cobra.Command { var ( - dbv0 string + dbv1 string snapshotPath string storekey string concurrency int ) cmd := &cobra.Command{ Use: "snapshot", - Short: "ingest latest iavl v0 application.db to a pre-order snapshot", + Short: "ingest latest iavl v1 application.db to a pre-order snapshot", RunE: func(cmd *cobra.Command, args []string) error { - rs, err := core.NewReadonlyStore(dbv0) + rs, err := core.NewReadonlyStore(dbv1) if err != nil { return err } @@ -191,7 +191,7 @@ func snapshotCommand() *cobra.Command { log := logz.Logger.With().Str("store", sk).Logger() log.Info().Msgf("migrating %s", sk) - s, err := core.NewReadonlyStore(dbv0) + s, err := core.NewReadonlyStore(dbv1) if err != nil { panic(err) } @@ -249,8 +249,8 @@ func snapshotCommand() *cobra.Command { }, } - cmd.Flags().StringVar(&dbv0, "db-v0", "", "Path to the v0 application.db") - if err := cmd.MarkFlagRequired("db-v0"); err != nil { + cmd.Flags().StringVar(&dbv1, "db-v1", "", "Path to the v1 application.db") + if err := cmd.MarkFlagRequired("db-v1"); err != nil { panic(err) } cmd.Flags().StringVar(&snapshotPath, "snapshot-path", "", "Path to the snapshot") @@ -265,16 +265,16 @@ func snapshotCommand() *cobra.Command { func allCommand() *cobra.Command { var ( - dbv0 string + dbv1 string dbv2 string storekey string concurrency int ) cmd := &cobra.Command{ Use: "all", - Short: "migrate latest iavl v0 application.db state to iavl v2 in sqlite", + Short: "migrate latest iavl v1 application.db state to iavl v2 in sqlite", RunE: func(cmd *cobra.Command, args []string) error { - rs, err := core.NewReadonlyStore(dbv0) + rs, err := core.NewReadonlyStore(dbv1) if err != nil { return err } @@ -308,7 +308,7 @@ func allCommand() *cobra.Command { log := logz.Logger.With().Str("store", sk).Logger() log.Info().Msgf("migrating %s", sk) - s, err := core.NewReadonlyStore(dbv0) + s, err := core.NewReadonlyStore(dbv1) if err != nil { panic(err) } @@ -372,10 +372,10 @@ func allCommand() *cobra.Command { return nil }, } - cmd.Flags().StringVar(&dbv0, "db-v0", "", "Path to the v0 application.db") + cmd.Flags().StringVar(&dbv1, "db-v1", "", "Path to the v1 application.db") cmd.Flags().StringVar(&dbv2, "db-v2", "", "Path to the v2 root") cmd.Flags().StringVar(&storekey, "store-key", "", "Store key to migrate") - if err := cmd.MarkFlagRequired("db-v0"); err != nil { + if err := cmd.MarkFlagRequired("db-v1"); err != nil { panic(err) } if err := cmd.MarkFlagRequired("db-v2"); err != nil { diff --git a/v2/migrate/v0/types.go b/v2/migrate/v1/types.go similarity index 99% rename from v2/migrate/v0/types.go rename to v2/migrate/v1/types.go index 443b1fff5..a1a50c5e2 100644 --- a/v2/migrate/v0/types.go +++ b/v2/migrate/v1/types.go @@ -1,4 +1,4 @@ -package v0 +package v1 import ( "time"