Skip to content

Commit

Permalink
Add an option to hide sectors in Removed for sectors list.
Browse files Browse the repository at this point in the history
  • Loading branch information
jennijuju committed Sep 17, 2020
1 parent 0c1c19c commit 14a4ace
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions cmd/lotus-storage-miner/sectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"os"
"sort"
"strconv"
Expand Down Expand Up @@ -136,6 +137,12 @@ var sectorsStatusCmd = &cli.Command{
var sectorsListCmd = &cli.Command{
Name: "list",
Usage: "List sectors",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "hide-removed",
Usage: "to hide Removed sectors",
},
},
Action: func(cctx *cli.Context) error {
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
Expand Down Expand Up @@ -192,19 +199,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("hide-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 14a4ace

Please sign in to comment.