btrask / stronglink

A searchable, syncable, content-addressable notetaking system
Other
1.04k stars 39 forks source link

File deletion #30

Open btrask opened 9 years ago

btrask commented 9 years ago

We should be able to gracefully handle file deletion.

Deletions will never sync between repositories. Deleting a file only deletes it from the local repository. This is critical for backups, etc.

Right now if a file is manually deleted I think things should mostly just work, but I haven't tested it. There should probably also be a way to remove the related data from the database.

What happens when trying to sync a deleted file is a big issue. If a file is temporarily unavailable, but re-added later, the downstream repository might never notice. To prevent that:

  1. When a file is intentionally deleted, the meta-data in the DB should also be removed or hidden.
  2. When syncing, if we get a file we can't load (status code 404 or 410), we must just stop the sync.
  3. If a once-deleted file is re-added, it should get a new file ID.

We should probably also remove any orphaned meta-files.