ARK-Builders / ARK-Navigator

Android app for navigation through your data
MIT License
15 stars 15 forks source link

Duplicates detection #140

Open kirillt opened 2 years ago

kirillt commented 2 years ago

Right now, if a user has several copies of the same file (with the some content and id), only one file is displayed. In case of deletion, only one copy is deleted and one of other copies is displayed next time. Tags are stored for all copies at the same time due to usage of content-addressing.

Most likely, several copies of the same resource is a user's mistake. But it also might happen intentionally as back-up mechanism. Given that the app is supposed to be used in kinda distributed setup (using external syncing app like Syncthing) such a back-up should be redundant.

It seems like a good idea to detect such duplicates and present information about them to the user as counter on single item. The [delete] button should be replaced by two then: [delete copies] and [delete all]. Maybe it would be simpler to suggest to the user to remove duplicates if such were found. Or preference may be added to the settings screen.

CloudLevi commented 2 years ago

Sketch of a prompted deletion scree

Screenshot 2021-11-20 at 16 07 24
kirillt commented 2 years ago

Duplicates detection appears to be more important than it seems since duplicates can be false duplicates: two or more resources might have the same id due to collisions of hash function used. Right now, we don't use cryptographical hash functions due to performance reasons. We use CRC32 function and it might have pretty high probability of collisions.

Open questions:

  1. Probability of collisions for CRC32 function.
  2. How to make false duplicates to look like different resources to us?
melvin4u445 commented 2 years ago