Add API and CLI to unseal sector (#10626)

This commit is contained in:
Shrenuj Bansal
2023-04-17 12:12:15 -04:00
committed by GitHub
parent 3f74840b67
commit 0befed7200
10 changed files with 97 additions and 0 deletions
+25
View File
@@ -67,6 +67,7 @@ var sectorsCmd = &cli.Command{
sectorsBatching,
sectorsRefreshPieceMatchingCmd,
sectorsCompactPartitionsCmd,
sectorsUnsealCmd,
},
}
@@ -2254,3 +2255,27 @@ var sectorsNumbersFreeCmd = &cli.Command{
return minerAPI.SectorNumFree(ctx, cctx.Args().First())
},
}
var sectorsUnsealCmd = &cli.Command{
Name: "unseal",
Usage: "unseal a sector",
ArgsUsage: "[sector number]",
Action: func(cctx *cli.Context) error {
minerAPI, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()
ctx := lcli.ReqContext(cctx)
if cctx.NArg() != 1 {
return lcli.IncorrectNumArgs(cctx)
}
sectorNum, err := strconv.ParseUint(cctx.Args().Get(0), 10, 64)
if err != nil {
return xerrors.Errorf("could not parse sector number: %w", err)
}
return minerAPI.SectorUnseal(ctx, abi.SectorNumber(sectorNum))
},
}