-
Notifications
You must be signed in to change notification settings - Fork 36
workspace deletion behavior (should files be deleted?) #274
Description
Description:
There is an ambiguity regarding what should happen to files when a workspace is deleted. This depends on how we conceptually model workspaces.
Case 1 — Workspace as a View
Setting:
- Collection: main storage of files
- Partition: logical grouping of data
- Workspace: behaves like a view over a set of files in a partition
Implication: Yn that case, deleting a workspace should not delete the associated files, similar to deleting a SQL view.
Case 2 — Workspace as a Container / Partition
In Twake, the storage model is the following:
- One partition per user: Here a partition is akin to a collection
- The user can create a workspace to work with a set of files: Here a workspace is akin to partition
Implication: In this setup, files are associated with workspaces. When a workspace is deleted, some files may become orphan files (files that are no longer associated with any workspace). Then it does make sense to delete orphan files.
Solution
Allow both behaviors via an API parameter by adding a delete_files boolean option in the endpoint:
openrag/openrag/routers/workspaces.py
Lines 100 to 104 in c1fe53a
| @router.delete( | |
| "/partition/{partition}/workspaces/{workspace_id}", | |
| dependencies=[Depends(require_partition_owner)], | |
| ) | |
| async def delete_workspace( |