Currently trying to understand the multicodec, I realize that i don’t really get the goal of it.
I have understood that it encodes the data of a node However why it is useful ? CIDv1 use Raw by default (so no encoding algorithm) it allows storage optimization. Why someone would use an encoding algorithm ?
Also, learning about the different encoding algorithm I learned that DAG-CBOR include the all IPLD data model but DAG-PB only a subset.
No no. Kubo, when specifying CIDv1 formatting for CIDs, also, by default, enables raw leaves. The RAW codec is only used for leaves. If you had a folder, or a file larger than the chunking size, you would get CIDv1s that use the dab-pb codec instead. In the case of raw leaves there is simply nothing to interpret on how to parse the content that is referenced by the CID, as it is just raw data. But otherwise, we need to know that they are dag-pb, otherwise it wouldn’t be possible to know if it has children etc. You can also have CIDv1 without raw leaves if you want.
DAG-PB is a “payload” + links section. DAG-CBOR/JSON you can have objects with any structure and link values at any point of that structure etc.