Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing Soft Delete of Images #290

Open
jue-henry opened this issue Jan 8, 2025 · 0 comments
Open

Implementing Soft Delete of Images #290

jue-henry opened this issue Jan 8, 2025 · 0 comments

Comments

@jue-henry
Copy link
Contributor

jue-henry commented Jan 8, 2025

After the implementation of the image deletion async task, discussion was started on the repercussions of permanently deleting images in the backend. Since animl is being viewed/used as an image hosting service by many of our users, we are starting to see the need for the reversibility of image deletion. A proposed solution would be to instead of immediately deleting the image records from mongoDB, we can flag the records for deletion at a later time by some kind of automated process.

Proposed solution:

  1. mark images in mongoDB records, such as Image.queuedForDeletion: true, and also create a Image.queuedForDeletionDate: 01/01/2025. The queued for deletion date can be the date when the image is first queued for deletion or it can be the date it is meant to be deleted by
  2. create a process that runs on a schedule checking for images queued for deletion and deleting them after the appropriate time requirement along with the corresponding s3 objects
    This would be the more performant option as it offloads most of the processing to the scheduled process, and only needs to flip a flag on each image, which I imagine is simpler than deleting an image record. This also preserves the most information, such as any human created objects, and any validation that is done by a human.

Alternative solution that I have been thinking about, but not fully thought out:

  1. leave as is by deleting the mongo records but instead moving the s3 objects to a temporary bucket with a retention policy
  2. if a user wishes to recover these images, we can download the images and allow them to reupload the images and just create new mongo records instead
    This solution would be less performant than the original proposed solution, but also makes the image recovery process a bit simpler, while also making the implementation easier. There would be some information lost with the mongo record deletions, but not sure how critical some of that information would be.

reference to the initial discussion notes: #148 (comment)

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

No branches or pull requests

1 participant