1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 19:32:24 +08:00

include hash of resolved object in object stat output

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
Jeromy
2015-07-21 07:55:58 -07:00
parent d37ecbbb31
commit 1c74bc57d7
2 changed files with 15 additions and 1 deletions

View File

@ -23,6 +23,7 @@ type Node struct {
// NodeStat is a statistics object for a Node. Mostly sizes.
type NodeStat struct {
Hash string
NumLinks int // number of links in link table
BlockSize int // size of the raw, encoded data
LinksSize int // size of the links segment
@ -201,7 +202,13 @@ func (n *Node) Stat() (*NodeStat, error) {
return nil, err
}
key, err := n.Key()
if err != nil {
return nil, err
}
return &NodeStat{
Hash: key.B58String(),
NumLinks: len(n.Links),
BlockSize: len(enc),
LinksSize: len(enc) - len(n.Data), // includes framing.