MCPcopy Create free account
hub / github.com/endbasic/endbasic / delete

Method delete

web/src/store.rs:237–254  ·  view source on GitHub ↗
(&mut self, name: &str)

Source from the content-addressed store, hash-verified

235#[async_trait(?Send)]
236impl Drive for WebDrive {
237 async fn delete(&mut self, name: &str) -> io::Result<()> {
238 let key = Key::for_name(name);
239 let key = key.serialized();
240
241 match self.storage.get(key) {
242 Ok(Some(_)) => (), // File exists.
243 Ok(None) => return Err(io::Error::new(io::ErrorKind::NotFound, "File not found")),
244 Err(_) => (), // Fall through to try deletion anyway.
245 }
246
247 match self.storage.delete(key) {
248 Ok(()) => Ok(()),
249 Err(e) => Err(io::Error::other(format!(
250 "Failed to put remove storage entry with key {}: {:?}",
251 key, e
252 ))),
253 }
254 }
255
256 async fn enumerate(&self) -> io::Result<DriveFiles> {
257 let mut entries = BTreeMap::new();

Callers 2

renameMethod · 0.45
test_webdrive_delete_okFunction · 0.45

Calls 2

serializedMethod · 0.80
getMethod · 0.45

Tested by 1

test_webdrive_delete_okFunction · 0.36