Skip to content
This repository has been archived by the owner. It is now read-only.

How are conflicts handled? #148

Closed
ulises opened this issue Jul 26, 2016 · 4 comments
Closed

How are conflicts handled? #148

ulises opened this issue Jul 26, 2016 · 4 comments
Labels

Comments

@ulises
Copy link

ulises commented Jul 26, 2016

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.

@RichardLitt RichardLitt changed the title New FAQ entry: how are conflicts handled? How are conflicts handled? Jul 26, 2016
@RichardLitt
Copy link
Contributor

RichardLitt commented Jul 26, 2016

Edited slightly to make a cleaner title. Thank you!

@flyingzumwalt
Copy link
Contributor

flyingzumwalt commented Jul 26, 2016

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.

@flyingzumwalt
Copy link
Contributor

flyingzumwalt commented Jul 26, 2016

Thanks to @Kubuxu and @whyrusleeping for helping me write this answer.

@flyingzumwalt
Copy link
Contributor

flyingzumwalt commented May 23, 2017

This issue was moved to https://discuss.ipfs.io/t/how-are-conflicts-handled/469

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants