diff --git a/core/commands/dag/stat.go b/core/commands/dag/stat.go index a8897c79c80..23f4ab48167 100644 --- a/core/commands/dag/stat.go +++ b/core/commands/dag/stat.go @@ -47,7 +47,6 @@ func dagStat(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) DAG: nodeGetter, Order: traverse.DFSPre, Func: func(current traverse.State) error { - fmt.Println("previousDagStatSize:", dagstats.Size) currentNodeSize := uint64(len(current.Node.RawData())) dagstats.Size += currentNodeSize dagstats.NumBlocks++ diff --git a/docs/changelogs/v0.21.md b/docs/changelogs/v0.21.md index fe369ef9070..e000208a486 100644 --- a/docs/changelogs/v0.21.md +++ b/docs/changelogs/v0.21.md @@ -11,6 +11,7 @@ - [`client/rpc` migration of `go-ipfs-http-client`](#clientrpc-migration-of-go-ipfs-http-client) - [Gateway: DAG-CBOR/-JSON previews and improved error pages](#gateway-dag-cbor-json-previews-and-improved-error-pages) - [Gateway: subdomain redirects are now `text/html`](#gateway-subdomain-redirects-are-now-texthtml) + - [`ipfs dag stat` deduping statistics](#ipfs-dag-stat-deduping-statistics) - [๐Ÿ“ Changelog](#-changelog) - [๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Contributors](#-contributors) @@ -102,6 +103,27 @@ $ curl "https://subdomain-gw.example.net/ipfs/${cid}/" Rationale can be found in [kubo#9913](https://github.com/ipfs/kubo/pull/9913). +#### `ipfs dag stat` deduping statistics + +`ipfs dat stat` now accept multiple CIDs and will dump advanced statistics +on the number of shared blocks and size of each CID. + +```console +$ ipfs dag stat --progress=false QmfXuRxzyVy5H2LssLgtXrKCrNvDY8UBvMp2aoW8LS8AYA QmfZDyu2UFfUhL4VdHaw7Hofivmn5D4DdQj38Lwo86RsnB + +CID Blocks Size +QmfXuRxzyVy5H2LssLgtXrKCrNvDY8UBvMp2aoW8LS8AYA 3 2151 +QmfZDyu2UFfUhL4VdHaw7Hofivmn5D4DdQj38Lwo86RsnB 4 3223 + +Summary +Total Size: 3326 +Unique Blocks: 5 +Shared Size: 2048 +Ratio: 1.615755 +``` + +`ipfs --enc=json dag stat`'s keys are a non breaking change, new keys have been added but old keys with previous sementics are still here. + ### ๐Ÿ“ Changelog ### ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Contributors