Skip to content

Commit

Permalink
Merge pull request #3903 from filecoin-project/3605-sector-list-option
Browse files Browse the repository at this point in the history
Add an option to hide sectors in Removed from `sectors list`.
  • Loading branch information
magik6k authored Sep 21, 2020
2 parents 14588d1 + 1096f8a commit 29913f4
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions cmd/lotus-storage-miner/sectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ var sectorsStatusCmd = &cli.Command{
var sectorsListCmd = &cli.Command{
Name: "list",
Usage: "List sectors",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "show-removed",
Usage: "show removed sectors",
},
},
Action: func(cctx *cli.Context) error {
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
Expand Down Expand Up @@ -194,19 +200,21 @@ var sectorsListCmd = &cli.Command{
continue
}

_, inSSet := commitedIDs[s]
_, inASet := activeIDs[s]

fmt.Fprintf(w, "%d: %s\tsSet: %s\tactive: %s\ttktH: %d\tseedH: %d\tdeals: %v\t toUpgrade:%t\n",
s,
st.State,
yesno(inSSet),
yesno(inASet),
st.Ticket.Epoch,
st.Seed.Epoch,
st.Deals,
st.ToUpgrade,
)
if cctx.Bool("show-removed") || st.State != api.SectorState(sealing.Removed) {
_, inSSet := commitedIDs[s]
_, inASet := activeIDs[s]

_, _ = fmt.Fprintf(w, "%d: %s\tsSet: %s\tactive: %s\ttktH: %d\tseedH: %d\tdeals: %v\t toUpgrade:%t\n",
s,
st.State,
yesno(inSSet),
yesno(inASet),
st.Ticket.Epoch,
st.Seed.Epoch,
st.Deals,
st.ToUpgrade,
)
}
}

return w.Flush()
Expand Down

0 comments on commit 29913f4

Please sign in to comment.