Merge pull request #4569 from filecoin-project/feat/client-deal-size-cli
Expose ClientDealSize via CLI
This commit is contained in:
commit
616e0e8eb5
@ -84,6 +84,7 @@ var clientCmd = &cli.Command{
|
|||||||
WithCategory("data", clientImportCmd),
|
WithCategory("data", clientImportCmd),
|
||||||
WithCategory("data", clientDropCmd),
|
WithCategory("data", clientDropCmd),
|
||||||
WithCategory("data", clientLocalCmd),
|
WithCategory("data", clientLocalCmd),
|
||||||
|
WithCategory("data", clientStat),
|
||||||
WithCategory("retrieval", clientFindCmd),
|
WithCategory("retrieval", clientFindCmd),
|
||||||
WithCategory("retrieval", clientRetrieveCmd),
|
WithCategory("retrieval", clientRetrieveCmd),
|
||||||
WithCategory("util", clientCommPCmd),
|
WithCategory("util", clientCommPCmd),
|
||||||
@ -1639,6 +1640,39 @@ var clientInfoCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var clientStat = &cli.Command{
|
||||||
|
Name: "stat",
|
||||||
|
Usage: "Print information about a locally stored file (piece size, etc)",
|
||||||
|
ArgsUsage: "<cid>",
|
||||||
|
Action: func(cctx *cli.Context) error {
|
||||||
|
api, closer, err := GetFullNodeAPI(cctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer closer()
|
||||||
|
ctx := ReqContext(cctx)
|
||||||
|
|
||||||
|
if !cctx.Args().Present() || cctx.NArg() != 1 {
|
||||||
|
return fmt.Errorf("must specify cid of data")
|
||||||
|
}
|
||||||
|
|
||||||
|
dataCid, err := cid.Parse(cctx.Args().First())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("parsing data cid: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
ds, err := api.ClientDealSize(ctx, dataCid)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Piece Size : %v\n", ds.PieceSize)
|
||||||
|
fmt.Printf("Payload Size: %v\n", ds.PayloadSize)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
var clientRestartTransfer = &cli.Command{
|
var clientRestartTransfer = &cli.Command{
|
||||||
Name: "restart-transfer",
|
Name: "restart-transfer",
|
||||||
Usage: "Force restart a stalled data transfer",
|
Usage: "Force restart a stalled data transfer",
|
||||||
|
Loading…
Reference in New Issue
Block a user