Hi, learning about dab-pb and unixFs I must say that I am a little bit confused about how the Merkle DAG is linked in IPFS.
Does a CID point to an Unixfs struct based on this protobuf and in the field data we may find data encoded with dag-pb, dag-cbor, …
Or a CID points to a Dag-pb, Dag-Json struct and in the field data we will find a unixfs protobuf struct.
Which structure really build the Merkle DAG ? Thanks a lot
By default, when you add something with Kubo, the CID points to a block of dag-pb type. That is, the block is the serialization of a protobuf (go-merkledag/merkledag.proto at master · ipfs/go-merkledag · GitHub). That node has two things: Links and Data.
Links is a list of other CIDs. Data is a binary payload.
That binary payload in this case corresponds to the unixfs protobuf (go-unixfs/unixfs.proto at master · ipfs/go-unixfs · GitHub).
A dag-pb merkledag does not necessarily have to carry a unixfs payload, but in the case of IPFS unixfs files, it is what it does. The idea is also that in order to sync, announce or generally traverse this Merkle DAG, you don’t need to interpret/parse all the unixfs data. You just need to follow the links. Payload is irrelevant and thus ipfs can be agnostic to it.