make the file store entirely synchronous, including the file deletion

This commit is contained in:
Tamo 2022-09-07 20:33:33 +02:00 committed by Clément Renault
parent a7aa92df5f
commit fa742f60e8
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -178,9 +178,9 @@ mod store {
Ok(self.get_update(uuid)?.metadata()?.len()) Ok(self.get_update(uuid)?.metadata()?.len())
} }
pub async fn delete(&self, uuid: Uuid) -> Result<()> { pub fn delete(&self, uuid: Uuid) -> Result<()> {
let path = self.path.join(uuid.to_string()); let path = self.path.join(uuid.to_string());
tokio::fs::remove_file(path).await?; std::fs::remove_file(path)?;
Ok(()) Ok(())
} }
} }
@ -248,9 +248,9 @@ mod test {
} }
} }
pub async fn delete(&self, uuid: Uuid) -> Result<()> { pub fn delete(&self, uuid: Uuid) -> Result<()> {
match self { match self {
MockUpdateFileStore::Real(s) => s.delete(uuid).await, MockUpdateFileStore::Real(s) => s.delete(uuid),
MockUpdateFileStore::Mock(mocker) => unsafe { mocker.get("delete").call(uuid) }, MockUpdateFileStore::Mock(mocker) => unsafe { mocker.get("delete").call(uuid) },
} }
} }