MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / drop_array

Method drop_array

nodedb/src/engine/array/engine.rs:143–152  ·  view source on GitHub ↗

Drop the per-core store for `id` and best-effort remove the on-disk segment directory. Called by the `DropArray` dispatch handler during `DROP ARRAY` broadcast so a follow-up `CREATE ARRAY` of the same name (potentially with a different schema) doesn't carry stale memtable / segment state. Idempotent: returns `Ok(())` when no store is open and no directory exists. Directory-removal errors are sur

(&mut self, id: &ArrayId)

Source from the content-addressed store, hash-verified

141 /// `ArrayEngineError::Io` so the broadcast's status reflects the
142 /// failure.
143 pub fn drop_array(&mut self, id: &ArrayId) -> ArrayEngineResult<()> {
144 let _ = self.arrays.remove(id);
145 let dir = array_dir(&self.cfg.root, id);
146 if dir.exists() {
147 std::fs::remove_dir_all(&dir).map_err(|e| ArrayEngineError::Io {
148 detail: format!("rmdir {dir:?}: {e}"),
149 })?;
150 }
151 Ok(())
152 }
153
154 pub fn store(&self, id: &ArrayId) -> ArrayEngineResult<&ArrayStore> {
155 self.arrays

Callers 2

dispatchFunction · 0.80
handle_array_dropMethod · 0.80

Calls 3

array_dirFunction · 0.85
removeMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected