Merge pull request #7308 from filecoin-project/feat/sectors-list-unproven
Add --unproven flag to the sectors list command
This commit is contained in:
commit
0a04302fb2
@ -268,6 +268,7 @@ var sectorsListCmd = &cli.Command{
|
|||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "show-removed",
|
Name: "show-removed",
|
||||||
Usage: "show removed sectors",
|
Usage: "show removed sectors",
|
||||||
|
Aliases: []string{"r"},
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "color",
|
Name: "color",
|
||||||
@ -278,10 +279,12 @@ var sectorsListCmd = &cli.Command{
|
|||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "fast",
|
Name: "fast",
|
||||||
Usage: "don't show on-chain info for better performance",
|
Usage: "don't show on-chain info for better performance",
|
||||||
|
Aliases: []string{"f"},
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "events",
|
Name: "events",
|
||||||
Usage: "display number of events the sector has received",
|
Usage: "display number of events the sector has received",
|
||||||
|
Aliases: []string{"e"},
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "seal-time",
|
Name: "seal-time",
|
||||||
@ -291,6 +294,11 @@ var sectorsListCmd = &cli.Command{
|
|||||||
Name: "states",
|
Name: "states",
|
||||||
Usage: "filter sectors by a comma-separated list of states",
|
Usage: "filter sectors by a comma-separated list of states",
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "unproven",
|
||||||
|
Usage: "only show sectors which aren't in the 'Proving' state",
|
||||||
|
Aliases: []string{"u"},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
if cctx.IsSet("color") {
|
if cctx.IsSet("color") {
|
||||||
@ -314,17 +322,33 @@ var sectorsListCmd = &cli.Command{
|
|||||||
var list []abi.SectorNumber
|
var list []abi.SectorNumber
|
||||||
|
|
||||||
showRemoved := cctx.Bool("show-removed")
|
showRemoved := cctx.Bool("show-removed")
|
||||||
states := cctx.String("states")
|
var states []api.SectorState
|
||||||
|
if cctx.IsSet("states") && cctx.IsSet("unproven") {
|
||||||
|
return xerrors.Errorf("only one of --states or --unproven can be specified at once")
|
||||||
|
}
|
||||||
|
|
||||||
|
if cctx.IsSet("states") {
|
||||||
|
showRemoved = true
|
||||||
|
sList := strings.Split(cctx.String("states"), ",")
|
||||||
|
states = make([]api.SectorState, len(sList))
|
||||||
|
for i := range sList {
|
||||||
|
states[i] = api.SectorState(sList[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if cctx.Bool("unproven") {
|
||||||
|
for state := range sealing.ExistSectorStateList {
|
||||||
|
if state == sealing.Proving {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
states = append(states, api.SectorState(state))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(states) == 0 {
|
if len(states) == 0 {
|
||||||
list, err = nodeApi.SectorsList(ctx)
|
list, err = nodeApi.SectorsList(ctx)
|
||||||
} else {
|
} else {
|
||||||
showRemoved = true
|
list, err = nodeApi.SectorsListInStates(ctx, states)
|
||||||
sList := strings.Split(states, ",")
|
|
||||||
ss := make([]api.SectorState, len(sList))
|
|
||||||
for i := range sList {
|
|
||||||
ss[i] = api.SectorState(sList[i])
|
|
||||||
}
|
|
||||||
list, err = nodeApi.SectorsListInStates(ctx, ss)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1532,12 +1532,13 @@ USAGE:
|
|||||||
lotus-miner sectors list [command options] [arguments...]
|
lotus-miner sectors list [command options] [arguments...]
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
--show-removed show removed sectors (default: false)
|
--show-removed, -r show removed sectors (default: false)
|
||||||
--color, -c use color in display output (default: depends on output being a TTY)
|
--color, -c use color in display output (default: depends on output being a TTY)
|
||||||
--fast don't show on-chain info for better performance (default: false)
|
--fast, -f don't show on-chain info for better performance (default: false)
|
||||||
--events display number of events the sector has received (default: false)
|
--events, -e display number of events the sector has received (default: false)
|
||||||
--seal-time display how long it took for the sector to be sealed (default: false)
|
--seal-time display how long it took for the sector to be sealed (default: false)
|
||||||
--states value filter sectors by a comma-separated list of states
|
--states value filter sectors by a comma-separated list of states
|
||||||
|
--unproven, -u only show sectors which aren't in the 'Proving' state (default: false)
|
||||||
--help, -h show help (default: false)
|
--help, -h show help (default: false)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user