Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Commit

Permalink
prune combo flag
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell committed Apr 21, 2024
1 parent 3291b66 commit 6301fb1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 14 additions & 1 deletion jprov/jprovd/provider_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ func MigrateCommand() *cobra.Command {
Long: `Migrate old file system. This will glue all blocks together into one file per fids stored in your machine`,
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
prune, err := cmd.Flags().GetBool(types.FlagPruneFirst)
if err != nil {
return err
}

buf := bufio.NewReader(cmd.InOrStdin())
yes, err := input.GetConfirmation("Are you sure you want to migrate from old file system?", buf, cmd.ErrOrStderr())
if err != nil {
Expand Down Expand Up @@ -374,8 +379,15 @@ func MigrateCommand() *cobra.Command {
return err
}

if prune {
err := fs.PruneExpiredFiles()
if err != nil {
return err
}
}
utils.Migrate(clientCtx, chunkSize)
return err

return nil
},
}
AddTxFlagsToCmd(cmd)
Expand All @@ -393,6 +405,7 @@ func MigrateCommand() *cobra.Command {
cmd.Flags().String(types.FlagProviderName, "A Storage Provider", "The name to identify this provider in block explorers.")
cmd.Flags().Int64(types.FlagSleep, types.DefaultSleep, "The time, in milliseconds, before adding another proof msg to the queue.")
cmd.Flags().Bool(types.FlagDoReport, types.DefaultDoReport, "Should this provider report deals (uses gas).")
cmd.Flags().Bool(types.FlagPruneFirst, false, "Should the provider prune its state before migration?")

return cmd
}
Expand Down
1 change: 1 addition & 0 deletions jprov/types/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
FlagProviderName = "moniker"
FlagSleep = "sleep"
FlagDoReport = "do-report"
FlagPruneFirst = "prune"
)

const (
Expand Down

0 comments on commit 6301fb1

Please sign in to comment.