Feat/add provingDeadlineInfoCmd live option
This commit is contained in:
parent
2375df2b62
commit
43ec14fa9c
@ -304,6 +304,14 @@ var provingDeadlineInfoCmd = &cli.Command{
|
|||||||
Name: "deadline",
|
Name: "deadline",
|
||||||
Usage: "View the current proving period deadline information by its index ",
|
Usage: "View the current proving period deadline information by its index ",
|
||||||
ArgsUsage: "<deadlineIdx>",
|
ArgsUsage: "<deadlineIdx>",
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "live",
|
||||||
|
Usage: "View deadline live sectors",
|
||||||
|
Value: false,
|
||||||
|
Aliases: []string{"l"},
|
||||||
|
},
|
||||||
|
},
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
|
|
||||||
if cctx.Args().Len() != 1 {
|
if cctx.Args().Len() != 1 {
|
||||||
@ -353,33 +361,64 @@ var provingDeadlineInfoCmd = &cli.Command{
|
|||||||
fmt.Printf("Proven Partitions: %d\n", provenPartitions)
|
fmt.Printf("Proven Partitions: %d\n", provenPartitions)
|
||||||
fmt.Printf("Current: %t\n\n", di.Index == dlIdx)
|
fmt.Printf("Current: %t\n\n", di.Index == dlIdx)
|
||||||
|
|
||||||
for pIdx, partition := range partitions {
|
if !cctx.Bool("live") {
|
||||||
sectorCount, err := partition.AllSectors.Count()
|
for pIdx, partition := range partitions {
|
||||||
if err != nil {
|
sectorCount, err := partition.AllSectors.Count()
|
||||||
return err
|
if err != nil {
|
||||||
}
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
sectorNumbers, err := partition.AllSectors.All(sectorCount)
|
sectorNumbers, err := partition.AllSectors.All(sectorCount)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
faultsCount, err := partition.FaultySectors.Count()
|
faultsCount, err := partition.FaultySectors.Count()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fn, err := partition.FaultySectors.All(faultsCount)
|
fn, err := partition.FaultySectors.All(faultsCount)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Partition Index: %d\n", pIdx)
|
fmt.Printf("Partition Index: %d\n", pIdx)
|
||||||
fmt.Printf("Sectors: %d\n", sectorCount)
|
fmt.Printf("Sectors: %d\n", sectorCount)
|
||||||
fmt.Printf("Sector Numbers: %v\n", sectorNumbers)
|
fmt.Printf("Sector Numbers: %v\n", sectorNumbers)
|
||||||
fmt.Printf("Faults: %d\n", faultsCount)
|
fmt.Printf("Faults: %d\n", faultsCount)
|
||||||
fmt.Printf("Faulty Sectors: %d\n", fn)
|
fmt.Printf("Faulty Sectors: %d\n", fn)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for pIdx, partition := range partitions {
|
||||||
|
sectorCount, err := partition.LiveSectors.Count()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
sectorNumbers, err := partition.LiveSectors.All(sectorCount)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
faultsCount, err := partition.FaultySectors.Count()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fn, err := partition.FaultySectors.All(faultsCount)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Partition Index: %d\n", pIdx)
|
||||||
|
fmt.Printf("Sectors: %d\n", sectorCount)
|
||||||
|
fmt.Printf("Sector Numbers: %v\n", sectorNumbers)
|
||||||
|
fmt.Printf("Faults: %d\n", faultsCount)
|
||||||
|
fmt.Printf("Faulty Sectors: %d\n", fn)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user