Merge pull request #8130 from filecoin-project/feat/lm-snap-clis
feat: Snapdeals support in `storage find` CLI
This commit is contained in:
commit
cf7a0415c1
@ -96,6 +96,11 @@ var infoAllCmd = &cli.Command{
|
|||||||
fmt.Println("ERROR: ", err)
|
fmt.Println("ERROR: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println("\n#: Storage Locks")
|
||||||
|
if err := storageLocks.Action(cctx); err != nil {
|
||||||
|
fmt.Println("ERROR: ", err)
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Println("\n#: Sched Diag")
|
fmt.Println("\n#: Sched Diag")
|
||||||
if err := sealingSchedDiagCmd.Action(cctx); err != nil {
|
if err := sealingSchedDiagCmd.Action(cctx); err != nil {
|
||||||
fmt.Println("ERROR: ", err)
|
fmt.Println("ERROR: ", err)
|
||||||
@ -192,6 +197,11 @@ var infoAllCmd = &cli.Command{
|
|||||||
fmt.Println("ERROR: ", err)
|
fmt.Println("ERROR: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println("\n#: Storage Sector List")
|
||||||
|
if err := storageListSectorsCmd.Action(cctx); err != nil {
|
||||||
|
fmt.Println("ERROR: ", err)
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Println("\n#: Expired Sectors")
|
fmt.Println("\n#: Expired Sectors")
|
||||||
if err := sectorsExpiredCmd.Action(cctx); err != nil {
|
if err := sectorsExpiredCmd.Action(cctx); err != nil {
|
||||||
fmt.Println("ERROR: ", err)
|
fmt.Println("ERROR: ", err)
|
||||||
|
@ -368,6 +368,7 @@ type storedSector struct {
|
|||||||
store stores.SectorStorageInfo
|
store stores.SectorStorageInfo
|
||||||
|
|
||||||
unsealed, sealed, cache bool
|
unsealed, sealed, cache bool
|
||||||
|
update, updatecache bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var storageFindCmd = &cli.Command{
|
var storageFindCmd = &cli.Command{
|
||||||
@ -421,6 +422,16 @@ var storageFindCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("finding cache: %w", err)
|
return xerrors.Errorf("finding cache: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
us, err := nodeApi.StorageFindSector(ctx, sid, storiface.FTUpdate, 0, false)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("finding sealed: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
uc, err := nodeApi.StorageFindSector(ctx, sid, storiface.FTUpdateCache, 0, false)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("finding cache: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
byId := map[stores.ID]*storedSector{}
|
byId := map[stores.ID]*storedSector{}
|
||||||
for _, info := range u {
|
for _, info := range u {
|
||||||
sts, ok := byId[info.ID]
|
sts, ok := byId[info.ID]
|
||||||
@ -455,6 +466,28 @@ var storageFindCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
sts.cache = true
|
sts.cache = true
|
||||||
}
|
}
|
||||||
|
for _, info := range us {
|
||||||
|
sts, ok := byId[info.ID]
|
||||||
|
if !ok {
|
||||||
|
sts = &storedSector{
|
||||||
|
id: info.ID,
|
||||||
|
store: info,
|
||||||
|
}
|
||||||
|
byId[info.ID] = sts
|
||||||
|
}
|
||||||
|
sts.update = true
|
||||||
|
}
|
||||||
|
for _, info := range uc {
|
||||||
|
sts, ok := byId[info.ID]
|
||||||
|
if !ok {
|
||||||
|
sts = &storedSector{
|
||||||
|
id: info.ID,
|
||||||
|
store: info,
|
||||||
|
}
|
||||||
|
byId[info.ID] = sts
|
||||||
|
}
|
||||||
|
sts.updatecache = true
|
||||||
|
}
|
||||||
|
|
||||||
local, err := nodeApi.StorageLocal(ctx)
|
local, err := nodeApi.StorageLocal(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -480,6 +513,12 @@ var storageFindCmd = &cli.Command{
|
|||||||
if info.cache {
|
if info.cache {
|
||||||
types += "Cache, "
|
types += "Cache, "
|
||||||
}
|
}
|
||||||
|
if info.update {
|
||||||
|
types += "Update, "
|
||||||
|
}
|
||||||
|
if info.updatecache {
|
||||||
|
types += "UpdateCache, "
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Printf("In %s (%s)\n", info.id, types[:len(types)-2])
|
fmt.Printf("In %s (%s)\n", info.id, types[:len(types)-2])
|
||||||
fmt.Printf("\tSealing: %t; Storage: %t\n", info.store.CanSeal, info.store.CanStore)
|
fmt.Printf("\tSealing: %t; Storage: %t\n", info.store.CanSeal, info.store.CanStore)
|
||||||
|
Loading…
Reference in New Issue
Block a user