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

Project files: Trashing project files directories upon deletion #381

Conversation

martastain
Copy link
Member

@martastain martastain commented Oct 10, 2024

#380

Local filesystem

Upon project deletion, the project directory is renamed to {project_name}.{timestamp}.trash

Since project names cannot contain . character, dot-delimination is non ambiguous, using a timestamp ( int(time.time()) allows multiple versions of the same project and restore the snapshot.

Sufffixing the projectname with .trash makes it easy to filter & delete.

Important

This approach ensures 100% backward compatibility with existing projects

image

S3

S3 does not support "directory" renaming so we need a different approach here:

  • every project storage from now uses {project_name}.{timestamp} as the project root. where the timestamp is the project created_at, so it's deterministic, can be paired with the current version of the project and the list can be sorted by versions/periods
  • when a project is deleted and recreated, a new unique project root will be created
  • The clean-up process will delete project directories not attached to any project after a grace period.

Warning

This is a breaking change that requires changing the project roots in S3 storages,
but as far as we know, S3 is not used anywhere in production yet.

image

@martastain martastain self-assigned this Oct 10, 2024
@martastain martastain added the type: feature Adding something new and exciting to the product label Oct 10, 2024
@BigRoy
Copy link
Contributor

BigRoy commented Oct 10, 2024

There is an S3 mv command (which apparently does cp and rm in the background according to comments here). Are we avoiding the copy and remove just because that's very costly? However, not sure why that one says there is such a thing because this very clearly states that S3 technically does not have folders?

Other than that the dot deliminiation and the timestamp seem reasonable to me.

@martastain
Copy link
Member Author

Yep. it is costly and also time consuming - and it is not a good idea to do that as the background process:

  • someone deletes a project
  • moving is executed on the background
  • during that period, a project with the same name is re-created (i did that yesterday several times)
  • new project files are created in the same path and they are mixed with the old files

@martastain martastain merged commit 0345a1e into develop Oct 10, 2024
@martastain martastain deleted the 380-project-files-mark-project-directory-as-trashed-upon-project-deletion branch October 21, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature Adding something new and exciting to the product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Project files: Mark project directory as trashed upon project deletion
2 participants