FledgeXu
FledgeXu

没什么想说的。

How the IPFS network saves files

Because I often write some articles related to IPFS, I find that a question often asked by ordinary people who don't know IPFS is: "Is it possible that as long as I upload a file to IPFS, the file can be stored in a distributed manner and never disappear. ?". This is a difficult question to answer because the correct answer is "yes and no". To explain this answer, we need to understand how the IPFS network works.

Suppose the following diagram is an IPFS network.

one

There are three operations in the IPFS network: Add, Get, and Pin.

Suppose we use the Add operation to add a file to the IPFS network, and the IPFS network will look like the following. (We use green to indicate that there is a cache of files in an IPFS node)

At this time, you just add the file to the IPFS cache. When the cache is full, IPFS will trigger the so-called "GC (garbage collection)" to delete the redundant files that are not "fixed". So if you just added files without pinning files and haven't shared files with others, after triggering garbage collection, the IPFS network will become empty again.

Of course you can also choose to pin files in your cache. Once pinned, it will not be removed by garbage collection. (We use blue to indicate that an IPFS node pinned a file)

At this time, you will ask, so this is not only the local storage of files, but the distributed storage? Yes, indeed. If you want the distributed power of IPFS to work, you have to share your files.

After you share the file, the IPFS network looks like after some people get the file.

Of course, some of these people may feel that this file is also very important to him, and he also chose to fix this file.

Because each node of the IPFS network can help distribute a file as long as there is a cache (in fact, you can have fragments of this file in your cache to help distribute, not necessarily the complete file, because different files may have the same block, which can speed up the entire network and save storage space). Suppose we encounter a situation where we upload and share a file, but accidentally lose the local IPFS cache. That is, like this.

But because there are other nodes in the IPFS network that help you save the file at this time, you can still get the file back.

Of course, in this case, even if the original publisher of the file no longer owns the file, those who want to obtain the file can also obtain the file from other nodes. (We assume the top left node is the original publisher).


Original link

CC BY-NC-ND 2.0

Like my work?
Don't forget to support or like, so I know you are with me..

was the first to support this article
Loading...

Comment