-1

I would like to get stats about IPFS objects, as follows

$ ipfs object stat  /ipfs/QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
NumLinks:       0
BlockSize:      119776
LinksSize:      4
DataSize:       119772
CumulativeSize: 119776

what does LinksSize mean?

Martin Monperrus
  • 1,845
  • 2
  • 19
  • 28

1 Answers1

0

LinksSize is the bytes used to store navigable links within a node. For example, here is snippet of code for calculating linksSize for a ProtoNode:

type ProtoNode struct {
    links []*format.Link
    data  []byte

    // cache encoded/marshaled value
    encoded *immutableProtoNode
    cached  cid.Cid

    // builder specifies cid version and hashing function
    builder cid.Builder
}

func (n *ProtoNode) Stat() (*format.NodeStat, error) {
    enc, err := n.EncodeProtobuf(false)
    if err != nil {
        return nil, err
    }

    cumSize, err := n.Size()
    if err != nil {
        return nil, err
    }

    return &format.NodeStat{
        Hash:           n.Cid().String(),
        NumLinks:       len(n.links),
        BlockSize:      len(enc),
        LinksSize:      len(enc) - len(n.data), // includes framing.
        DataSize:       len(n.data),
        CumulativeSize: int(cumSize),
    }, nil
}
gw3.io
  • 1
  • 4