How are conflicts handled?

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,

  1. un-pin the file
  2. 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.