Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose ClientDealSize via CLI #4569

Merged
merged 1 commit into from
Oct 27, 2020
Merged

Expose ClientDealSize via CLI #4569

merged 1 commit into from
Oct 27, 2020

Conversation

ingar
Copy link
Contributor

@ingar ingar commented Oct 23, 2020

Summary

While ClientDealSize is exposed via the JSON API, there are some users using the CLI that need this information to create deals (without using interactive deal creation).

NAME:
   lotus client deal-size - Calculate size of deal piece

USAGE:
   lotus client deal-size [command options] <cid>

Example output

./lotus client deal-size bafykbzaceclbis4au7xmwecpf6k2hy4uv4lpdfkm5tsn2syacn4snm2hzpdnk 
Deal sizes for data cid ...m2hzpdnk
  Piece Size: 134217728
Payload Size: 101920082

Copy link
Contributor

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of nits.

cli/client.go Outdated
return err
}

fmt.Printf("Deal sizes for data cid %s\n", ellipsis(dataCid.String(), 8))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this, the user has just provided this as a parameter

Suggested change
fmt.Printf("Deal sizes for data cid %s\n", ellipsis(dataCid.String(), 8))

cli/client.go Outdated
}

fmt.Printf("Deal sizes for data cid %s\n", ellipsis(dataCid.String(), 8))
fmt.Printf(" Piece Size: %v\n", ds.PieceSize)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf(" Piece Size: %v\n", ds.PieceSize)
fmt.Printf("Piece Size: %v\n", ds.PieceSize)

cli/client.go Outdated
@@ -1698,6 +1699,40 @@ var clientRestartTransfer = &cli.Command{
},
}

var clientDealSize = &cli.Command{
Name: "deal-size",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd call this stat in case we want to add other things here like CommP

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@magik6k magik6k merged commit 616e0e8 into master Oct 27, 2020
@magik6k magik6k deleted the feat/client-deal-size-cli branch October 27, 2020 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants