From @ulises on Tue Jul 26 2016 15:13:52 GMT+0000 (UTC)
If a node goes offline, a file is deleted in the node, and then it goes online again (netsplit or proper offline). What does the node do when it comes back online?
- Propagate the delete
- Get the file back from other nodes
- Something else
IIUC in matrix conflicts are passed on to the clients, so I wonder how these are resolved (if at all) in IPFS.
Copied from original issue: https://github.com/ipfs/faq/issues/148
From @RichardLitt on Tue Jul 26 2016 15:15:59 GMT+0000 (UTC)
Edited slightly to make a cleaner title. Thank you!
From @flyingzumwalt on Tue Jul 26 2016 15:46:18 GMT+0000 (UTC)
This is a repetition of some info thatās elsewhere in the FAQ. We should gather some of it together for clarity.
Relevant Ideas about how IPFS Currently Works
- Files donāt leave your machine until/unless a peer requests that file.
- Files donāt enter your machine until/unless you request that file.
- If you want a file to stay on your machine, you pin it
- Garbage collection deletes any local IPFS files that you have not pinned.
When you write a file into IPFS on a node, it does the following:
-
Builds the DAG representing that file, storing that DAG locally
-
Tells peers that the new entry exists by writing the corresponding hashes and some metadata into the DHT
Deleting Stuff
Local Deletes
To ādeleteā a file locally,
- un-pin the file
- run garbage collection
This removes the file from your local IPFS.
(not allowed) Deleting Other Peopleās Copies
The IPFS protocol does not support deleting content from other peopleās nodes. This is just like the web currently works ā after someone ādownloadsā a file from your machine, they control that copy. If you want those peers to delete their copies, thatās an out-of-band conversation you need to have beyond the IPFS protocol. Some approaches: smart contracts, emails, phone calls, etc.
Answer to the Original Question
Given the scenario you describe, where a file is deleted from your node while itās offline.
If nobody has ever pulled a copy of your file
If nobody has ever pulled a copy of your file, itās gone.
If any peers have pulled copies of your file
If any peers have pulled copies of your file AND they still have those copies, meaning they have either pinned the file on their node or they have not yet garbage collected, then the content is still available on the network. Next time you request that content, you will be doing a regular request for content on the network. Your local node will look up the hash for that content in the DHT, find the peers who have copies of the file, and pull the file from those peers.
From @flyingzumwalt on Tue Jul 26 2016 15:58:30 GMT+0000 (UTC)
Thanks to @Kubuxu and @whyrusleeping for helping me write this answer.
Iām trying to follow the instructions here, but I canāt find any clear instructions on how to ārun garbage collectionā.
ipfs commands
doesnāt list anything called ādeleteā or āgarbageā collect. Can someone tell me how to manually trigger garbage collection?
You want the ipfs repo gc command.
2 Likes