Return whether file has been deleted succesfully when delete is used.
#7414
Replies: 2 comments
-
|
We don't need that. Because what we ensure is "if delete returns In either cases, you don't need to check object metadata after calling If you do find that a file is still exist after |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for taking the time to answer. Apologies for the delayed response. I was quite busy. I've been experimenting with OpenDAL by trying to implement a distributed FIFO message queue. My specific use case is that I want to "move" a file once (this often means copying and deleting a file) and want to detect if another process connected to the same storage backend does so concurrently to avoid duplicating files. sequenceDiagram
participant ProcessA
participant ProcessB
participant StorageBackend
Note over StorageBackend: Initial state: File exists at /source/file.txt
ProcessA->>StorageBackend: Check if /source/file.txt exists
ProcessB->>StorageBackend: Check if /source/file.txt exists
StorageBackend-->>ProcessA: File exists
StorageBackend-->>ProcessB: File exists
ProcessA->>StorageBackend: COPY /source/file.txt to /destA/file.txt
ProcessB->>StorageBackend: COPY /source/file.txt to /destB/file.txt
StorageBackend-->>ProcessA: COPY successful
StorageBackend-->>ProcessB: COPY successful
ProcessA->>StorageBackend: DELETE /source/file.txt
ProcessB->>StorageBackend: DELETE /source/file.txt
StorageBackend-->>ProcessA: DELETE successful
StorageBackend-->>ProcessB: DELETE successful
Note over ProcessA,ProcessB: Both processes think they "moved" the file
Note over StorageBackend: File duplicated at /destA/file.txt AND /destB/file.txt
However, considering S3 apparently always returns the same response when deleting a file, I'll just implement it using the following procedure:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This avoids needing to stat the object
afterwardsbeforehanddelete currently returns
Result<()>. This could be changed toboolorOption<bool>if some backends don't provide that information.Beta Was this translation helpful? Give feedback.
All reactions