add option to only clear splistore keys

This commit is contained in:
vyzo 2021-08-03 15:32:53 +03:00 committed by Jennifer Wang
parent f312ba376c
commit 3983dadf3a

View File

@ -128,6 +128,10 @@ var splitstoreClearCmd = &cli.Command{
Name: "repo", Name: "repo",
Value: "~/.lotus", Value: "~/.lotus",
}, },
&cli.BoolFlag{
Name: "keys-only",
Usage: "only delete splitstore keys",
},
}, },
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
r, err := repo.NewFS(cctx.String("repo")) r, err := repo.NewFS(cctx.String("repo"))
@ -163,11 +167,13 @@ var splitstoreClearCmd = &cli.Command{
return xerrors.Errorf("splitstore is not enabled") return xerrors.Errorf("splitstore is not enabled")
} }
if !cctx.Bool("keys-only") {
fmt.Println("clearing splitstore directory...") fmt.Println("clearing splitstore directory...")
err = clearSplitstoreDir(lr) err = clearSplitstoreDir(lr)
if err != nil { if err != nil {
return xerrors.Errorf("error clearing splitstore directory: %w", err) return xerrors.Errorf("error clearing splitstore directory: %w", err)
} }
}
fmt.Println("deleting splitstore keys from metadata datastore...") fmt.Println("deleting splitstore keys from metadata datastore...")
err = deleteSplitstoreKeys(lr) err = deleteSplitstoreKeys(lr)