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

'ipfs block size' command #402

Closed
whyrusleeping opened this issue Dec 4, 2014 · 5 comments
Closed

'ipfs block size' command #402

whyrusleeping opened this issue Dec 4, 2014 · 5 comments
Labels
help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature

Comments

@whyrusleeping
Copy link
Member

It would be nice to have an additional subcommand to ipfs block (or maybe object) that allows us to just get some basic information about the individual block/object. (size, links, known references, etc)

@whyrusleeping whyrusleeping added kind/enhancement A net-new feature or improvement to an existing feature help wanted Seeking public contribution on this issue labels Dec 4, 2014
@jbenet
Copy link
Member

jbenet commented Dec 5, 2014

Yeah, would be nice. should these be subcmds or options?

> ipfs block size
> ipfs block --size

@mappum
Copy link
Contributor

mappum commented Dec 5, 2014

IMO a subcommand is nicer than an option (and stays consistent with all the other commands). It makes sense to do options if it's just filtering which fields get displayed (if ipfs block already showed size, then ---size could just hide the other fields in the output).

Sidenote: Maybe we should alias ipfs block to ipfs block get? That makes the command less verbose, however it also makes it a little bit harder to get to the help text for new users.

@jbenet
Copy link
Member

jbenet commented Dec 5, 2014

IMO a subcommand is nicer than an option (and stays consistent with all the other commands). It makes sense to do options if it's just filtering which fields get displayed (if ipfs block already showed size, then ---size could just hide the other fields in the output).

Yeah agreed. Maybe ipfs block stat returns various statistics. and has options to filter them:

ipfs block stat [ --size | --non-recursive-size | --links | --links-num ]

Maybe we should alias ipfs block to ipfs block get? That makes the command less verbose, however it also makes it a little bit harder to get to the help text for new users.

I think helptext + learning friendliness + explicitness is more important for now. We could revisit this once theres lots of people using these commands and we have people to gather opinions from.

In general, explicitness is more important than smaller verbosity, particularly since we can have an ipfs alias cmd like git's.

@jbenet
Copy link
Member

jbenet commented Jan 8, 2015

For now, this works:

> ipfs block stat QmdxNBJZZ3Uxze5PReFrv1zvyGUxnm4Bxmo9MMuWfi2p6A
Key: QmdxNBJZZ3Uxze5PReFrv1zvyGUxnm4Bxmo9MMuWfi2p6A
Size: 1008

> ipfs block stat QmdxNBJZZ3Uxze5PReFrv1zvyGUxnm4Bxmo9MMuWfi2p6A | grep Size
Size: 1008

@jbenet jbenet closed this as completed Jan 8, 2015
@jbenet
Copy link
Member

jbenet commented Jan 8, 2015

and, for the record, so does:

> ipfs object stat QmdxNBJZZ3Uxze5PReFrv1zvyGUxnm4Bxmo9MMuWfi2p6A
NumLinks: 0
BlockSize: 1008
LinksSize: 3
DataSize: 1005
CumulativeSize: 1008
> ipfs refs QmXL479QjT666FytJHW28DBVaJied2NZNNHkedvBDrGB28/cmd/ipfs
QmegoYVmJemuhdiv2JYaaKkptiaRGVmSxMoJadJnce1bWT
QmXMJ1oewy8hrru1gswxVPHS8kQs3tyjsUXBY33sJTaKeR
QmNWeWUPmgFkJUd1XhdGDLHqMAZeYcMFaDbCypZzJnYdXB
QmdKoNV2bgVj5SnHMAAMud9SG7ZgQrPQdVrry65pmXMta2
Qmct4XzAzPHoLZBVmpdHfcPbt9n6mXrWcMG6VKgH5qYyDg
QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn
QmeBN9wuTWUxfcdhERTY44uXWM8zFP61NSzt9u6oGeW39j
QmetVQNESdn7kFSwQrCyQwp6sqvSAEb9uFX76DLyf1t8VQ
QmfGBBD4HnoWgFPUe76ieBjEKHLeE27BYHh9BAQqGqrkSA
QmXTuJxaouYLkkJcs267g6TQa5kXny6GbgUKBCxGSWtftv
QmWxYQbWKrCLX9ARt1u8hzCSn5K8N1ELCH4hBdWa8qBQ1i
QmPLiaaDbqhsQS6BYWTY4pamvs7Cx3KF2j1sBRw7DvB33y
QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn
QmVSZq1kVD2My7LrijWyfyLr5CJRwdojaj5fGqjBDqzAD9
QmesV6L9sXGRQYeCbxrLo5SeJ1UxjZWXAoSxtAXDtc1CKt
QmNtpA5TBNqHrKf3cLQ1AiUKXiE4JmUodbG5gXrajg8wdv
QmUowN6425S3Ez18Egm1q46kcXnVgc1QcaJw4E9cNmxPMp
QmbJamvkvwkS5k7xLXf9BKoQP4gCvAzG8sveKknMdTth6f
>ipfs refs --format="  <src> -> <dst> [label=\"<linkname>\"];" QmXL479QjT666FytJHW28DBVaJied2NZNNHkedvBDrGB28/cmd/ipfs
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmegoYVmJemuhdiv2JYaaKkptiaRGVmSxMoJadJnce1bWT [label=".gitignore"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmXMJ1oewy8hrru1gswxVPHS8kQs3tyjsUXBY33sJTaKeR [label="Makefile"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmNWeWUPmgFkJUd1XhdGDLHqMAZeYcMFaDbCypZzJnYdXB [label="README.md"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmdKoNV2bgVj5SnHMAAMud9SG7ZgQrPQdVrry65pmXMta2 [label="daemon.go"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> Qmct4XzAzPHoLZBVmpdHfcPbt9n6mXrWcMG6VKgH5qYyDg [label="equinox.yaml"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn [label="fuse"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmeBN9wuTWUxfcdhERTY44uXWM8zFP61NSzt9u6oGeW39j [label="init.go"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmetVQNESdn7kFSwQrCyQwp6sqvSAEb9uFX76DLyf1t8VQ [label="ipfs"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmfGBBD4HnoWgFPUe76ieBjEKHLeE27BYHh9BAQqGqrkSA [label="ipfs.cpuprof"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmXTuJxaouYLkkJcs267g6TQa5kXny6GbgUKBCxGSWtftv [label="ipfs.go"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmWxYQbWKrCLX9ARt1u8hzCSn5K8N1ELCH4hBdWa8qBQ1i [label="ipfs.memprof"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmPLiaaDbqhsQS6BYWTY4pamvs7Cx3KF2j1sBRw7DvB33y [label="ipfsHandler.go"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn [label="ipfsdir"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmVSZq1kVD2My7LrijWyfyLr5CJRwdojaj5fGqjBDqzAD9 [label="main.go"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmesV6L9sXGRQYeCbxrLo5SeJ1UxjZWXAoSxtAXDtc1CKt [label="main_test.go"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmNtpA5TBNqHrKf3cLQ1AiUKXiE4JmUodbG5gXrajg8wdv [label="test"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmUowN6425S3Ez18Egm1q46kcXnVgc1QcaJw4E9cNmxPMp [label="tour.go"];
  QmR7ksjTMNejks4Zzt2uMUGYF6z2TUnDavuYceL8jVuUKA -> QmbJamvkvwkS5k7xLXf9BKoQP4gCvAzG8sveKknMdTth6f [label="tour_test.go"];

Which is how i mage:

bin/graphmd QmXL479QjT666FytJHW28DBVaJied2NZNNHkedvBDrGB28/cmd/ipfs | dot -Tpdf > foo.pdf

http://jbenet.static.s3.amazonaws.com/3cdd72b/foo.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants