pub async fn delete_file(
db: &DbPool,
storage: &TenantStorageLayer,
search: &TenantSearchIndex,
events: &TenantEventPublisher,
file: File,
scope: DocumentBoxScopeRaw,
) -> Result<(), DeleteFileError>Expand description
Deletes a file and all associated generated files.
Deletes files from S3 before deleting the database metadata to prevent dangling files in the bucket. Same goes for the search index
This process cannot be rolled back since the changes to S3 are permanent. If a failure occurs after generated files are deleted they will stay deleted.
We may choose to revise this to load the generated files into memory in order to restore them on failure.