-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terminology: Block vs Object (vs Node) #5058
Comments
I think you’ve mostly got it right, at least as far as my understanding goes. One thing that probably makes this confusing is that IPFS’s old “MerkleDAG” format (which UnixFS is a layer above) is being very slowly replaced by the IPLD format (also a type of [merkle] DAG). An object is specifically a block that is formatted according to the old MerkleDAG format. A UnixFS file node is an object whose (Worth noting: determining that an object represents a UnixFS file node tells you how to interpret the object’s Here’s how I think of it:
Or in CLI terms: # If we have a UnixFS directory stored at QmVUdHfpo9hyC8wXmgd2frRrsp83iRvuL8HWyp1LPzjsPq...
# Blocks are raw data:
$ ipfs block get QmVUdHfpo9hyC8wXmgd2frRrsp83iRvuL8HWyp1LPzjsPq
[...binary data omitted... ]
# Objects are things with `Links` (a list of specialized objects) and `Data` (binary blob):
$ ipfs object get QmVUdHfpo9hyC8wXmgd2frRrsp83iRvuL8HWyp1LPzjsPq | jq
{
"Links": [
{
"Name": "assets",
"Hash": "QmTAn8ipupd4Hu2XxekSwxpwXqYsrttwqYmf3Eakd5c1KS",
"Size": 1862319
},
{
"Name": "categories",
"Hash": "Qmd55L3rJ2BhiXpeZV49VB49Y1TpeqDdRDqrDTPjzCh51X",
"Size": 27146
},
# [...more links omitted...]
],
"Data": "\b\u0001" # <- Note this is a binary string. At the "object" level, we still don't know how to parse it.
}
# UnixFS file nodes are used by top-level commands like ls, add, cat, get:
$ ipfs ls --headers QmVUdHfpo9hyC8wXmgd2frRrsp83iRvuL8HWyp1LPzjsPq
Hash Size Name
QmTAn8ipupd4Hu2XxekSwxpwXqYsrttwqYmf3Eakd5c1KS 1862319 assets/
Qmd55L3rJ2BhiXpeZV49VB49Y1TpeqDdRDqrDTPjzCh51X 27146 categories/
QmTLGx8mKCjQoa51Cd89MrzfRanUeCPsmcKbgJXiwouHg7 122471 community/
# [...more entries omitted...] Also: the Finally, it’s somewhat important that MerkleDAG nodes and IPLD nodes are a level below UnixFS. The idea here is that you could use them to represent all kinds of immutable DAGs besides files. You could make a database or a blockchain or whatever out of linked, content-addressable items (if you had to go down to the |
@Mr0grog First, thank you very much for that diagram, that is exactly the kind of final product I aspire to at the end of this milestone. I need to take a closer look at the IPLD spec, I agree with your general description, we can clearly distinguish three distinct protocol layers (three vertical levels in your diagram), but there is a gap between the code base and the specifications that I would like to bridge. From the code, an IPLD I have more to say about the subject, but first I would like to check if we're talking about the same thing and that the interface and structure I'm pointing to are indeed the two specs you're linking.
Your previous comment makes me suspect they're not (I'm sensing there's something I'm missing here) because I'm pointing to an interface and a structure, the latter implements the former, one cannot "slowly replace" the other. |
Independent of that, returning to the three layers we agree on, I think it would really help the conversation to also include in the specifications (so I should raise an issue there but first I would like to discuss it here) different names for the "thing that encapsulates data" in each layer. I think we all agree that Block is at the bottom, raw bytes. After that there's one "thing" that adds links to the blocks so we can join them in a DAG (Node? Object? Thing with links?). On top of that there's pretty much everything else, a file, a git commit, a chat, a filecoin, etc. It would be nice to have a different word at this layer to append to these, e.g., "gadget" (just for the sake of this argument), and we could refer to the "unix file gadget", the "git commit gadget" and similar, and applying this "gadget" suffix would hint the reader we're referring to the known world but with an underlying IPFS representation. Does that make sense? |
@Mr0grog's diagram looks mostly correct (and that example is a bit out of date). However, technically, the hiererchy is:
Or, more explicitly,
That, we started with:
And then replaced the merkledag with a more generalized IPLD. Now, currently, we don't allow UnixFS 1 nodes to be encoded in CBOR. Technically, we should. However, this restriction may make our lives easier in the future (for complicated reasons I won't get into). |
From the IPFS example Dealing With Blocks:
I think the block distinction is very clearly explained but I'm having trouble assimilating the Object term, which pretty much seems to be dealing with DAG nodes,
Ideally it would be nice to have a single term for the PDU (abusing a bit the OSI terminology) of each of the layers that make up information in IPFS, something like (UnixFS) Object over a (DAG) Node over a (raw) Block (this is just an example off the top of my head). Right now Object and Node seem to be overlapping.
The text was updated successfully, but these errors were encountered: