Address review

This commit is contained in:
Łukasz Magiera 2020-06-23 14:44:34 +02:00
parent cd91e42a56
commit f8e7901b89
2 changed files with 12 additions and 11 deletions

View File

@ -206,7 +206,7 @@ type StorageMinerStruct struct {
SectorsList func(context.Context) ([]abi.SectorNumber, error) `perm:"read"` SectorsList func(context.Context) ([]abi.SectorNumber, error) `perm:"read"`
SectorsRefs func(context.Context) (map[string][]api.SealedRef, error) `perm:"read"` SectorsRefs func(context.Context) (map[string][]api.SealedRef, error) `perm:"read"`
SectorsUpdate func(context.Context, abi.SectorNumber, api.SectorState) error `perm:"write"` SectorsUpdate func(context.Context, abi.SectorNumber, api.SectorState) error `perm:"write"`
SectorRemove func(context.Context, abi.SectorNumber) error `perm:"admin"` SectorRemove func(context.Context, abi.SectorNumber) error `perm:"admin"`
WorkerConnect func(context.Context, string) error `perm:"admin"` // TODO: worker perm WorkerConnect func(context.Context, string) error `perm:"admin"` // TODO: worker perm
WorkerStats func(context.Context) (map[uint64]storiface.WorkerStats, error) `perm:"admin"` WorkerStats func(context.Context) (map[uint64]storiface.WorkerStats, error) `perm:"admin"`

View File

@ -47,8 +47,9 @@ var sectorsPledgeCmd = &cli.Command{
} }
var sectorsStatusCmd = &cli.Command{ var sectorsStatusCmd = &cli.Command{
Name: "status", Name: "status",
Usage: "Get the seal status of a sector by its ID", Usage: "Get the seal status of a sector by its number",
ArgsUsage: "<sectorNum>",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.BoolFlag{ &cli.BoolFlag{
Name: "log", Name: "log",
@ -64,7 +65,7 @@ var sectorsStatusCmd = &cli.Command{
ctx := lcli.ReqContext(cctx) ctx := lcli.ReqContext(cctx)
if !cctx.Args().Present() { if !cctx.Args().Present() {
return fmt.Errorf("must specify sector ID to get status of") return fmt.Errorf("must specify sector number to get status of")
} }
id, err := strconv.ParseUint(cctx.Args().First(), 10, 64) id, err := strconv.ParseUint(cctx.Args().First(), 10, 64)
@ -209,10 +210,10 @@ var sectorsRefsCmd = &cli.Command{
}, },
} }
var sectorsRemoveCmd = &cli.Command{ var sectorsRemoveCmd = &cli.Command{
Name: "remove", Name: "remove",
Usage: "Forcefully remove a sector (WARNING: This means losing power and collateral for the removed sector)", Usage: "Forcefully remove a sector (WARNING: This means losing power and collateral for the removed sector)",
ArgsUsage: "<sectorNum>",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.BoolFlag{ &cli.BoolFlag{
Name: "really-do-it", Name: "really-do-it",
@ -230,12 +231,12 @@ var sectorsRemoveCmd = &cli.Command{
defer closer() defer closer()
ctx := lcli.ReqContext(cctx) ctx := lcli.ReqContext(cctx)
if cctx.Args().Len() != 1 { if cctx.Args().Len() != 1 {
return xerrors.Errorf("must pass sector ID") return xerrors.Errorf("must pass sector number")
} }
id, err := strconv.ParseUint(cctx.Args().Get(0), 10, 64) id, err := strconv.ParseUint(cctx.Args().Get(0), 10, 64)
if err != nil { if err != nil {
return xerrors.Errorf("could not parse sector ID: %w", err) return xerrors.Errorf("could not parse sector number: %w", err)
} }
return nodeApi.SectorRemove(ctx, abi.SectorNumber(id)) return nodeApi.SectorRemove(ctx, abi.SectorNumber(id))
@ -262,12 +263,12 @@ var sectorsUpdateCmd = &cli.Command{
defer closer() defer closer()
ctx := lcli.ReqContext(cctx) ctx := lcli.ReqContext(cctx)
if cctx.Args().Len() < 2 { if cctx.Args().Len() < 2 {
return xerrors.Errorf("must pass sector ID and new state") return xerrors.Errorf("must pass sector number and new state")
} }
id, err := strconv.ParseUint(cctx.Args().Get(0), 10, 64) id, err := strconv.ParseUint(cctx.Args().Get(0), 10, 64)
if err != nil { if err != nil {
return xerrors.Errorf("could not parse sector ID: %w", err) return xerrors.Errorf("could not parse sector number: %w", err)
} }
return nodeApi.SectorsUpdate(ctx, abi.SectorNumber(id), api.SectorState(cctx.Args().Get(1))) return nodeApi.SectorsUpdate(ctx, abi.SectorNumber(id), api.SectorState(cctx.Args().Get(1)))