Hi, does IPFS store full size file on every node?
the size of each chunk(a small part of file) is stored with the chunk itself(within IPLD, which is the data structure used to store data on IPFS).
Here is how it looks like
{
“Links”: [
{
“Name”: “”,
“Hash”: “QmZ5RgT3jJhRNMEgLSEsez9uz1oDnNeAysLLxRco8jz5Be”,
“Size”: 262158
},
{
“Name”: “”,
“Hash”: “QmUZvm5TertyZagJfoaw5E5DRvH6Ssu4Wsdfw69NHaNRTc”,
“Size”: 262158
}],
“Data”: “\b\u0002\u0018Ơ�\u0001 ��\u0010 ��\u0010 ��\u0010 ��\u0010 ��\u0010 ��\u0010 ��\u0010 ��\u0010 ��\u0010 ��\u0010 ��\u0010 ��\u0010 ��\u0010 ��\u0010 Ơ\u0004”
}
Here you can see the size of the chunks, their names, hashes and raw data.
Thank you for your answer, but what happen when I have only two IPFS nodes(Private IPFS), and if I shutdown one node, and try to download file using IPFS hash how it will react? does it download full file and if yes then how it works?
It depends on if the file is replicated over the running node or not.
Let’s say you have node1 & node2. You added the file to node1 and shut it down after a while. Now you try to fetch the file via node2(the running node).
There are 3 scenarios:
-
If the file is NOT AT ALL replicated over the node2, then you won’t get any response and the request will be hanging till the timeout.
-
SOME CHUNKS of the file is replicated over the node2. But as not all the chunks are available, you won’t get your file and request will again hang till timeout.
-
If your file is TOTALLY replicated over the node2, then you will be able to fetch the file easily without much delay.
If you want to control the distribution of data efficiently over a number of IPFS nodes, then check out IPFS Cluster. Using IPFS Cluster you can orchestrate the pinset(the set of pinned data) over a number of IPFS nodes.
Hi,
Can you please clarify that in which scenario would partial replication happen?
One scenario which I could think of is that you ipfs add <data>
, where data
is a large file which would form multiple blocks in IPFS, and you fetch one of these blocks on another node.
Is there any other scenario where automatically some blocks of the file are replicated to another node?