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

Method delete_sequence

nodedb/src/control/security/catalog/sequences.rs:59–82  ·  view source on GitHub ↗

Delete a sequence definition. Returns true if it existed.

(&self, tenant_id: u64, name: &str)

Source from the content-addressed store, hash-verified

57
58 /// Delete a sequence definition. Returns true if it existed.
59 pub fn delete_sequence(&self, tenant_id: u64, name: &str) -> crate::Result<bool> {
60 let key = sequence_key(tenant_id, name);
61 let write_txn = self
62 .db
63 .begin_write()
64 .map_err(|e| catalog_err("write txn", e))?;
65 let existed;
66 {
67 let mut table = write_txn
68 .open_table(SEQUENCES)
69 .map_err(|e| catalog_err("open sequences", e))?;
70 existed = table
71 .remove(key.as_str())
72 .map_err(|e| catalog_err("delete sequence", e))?
73 .is_some();
74 // Also remove the runtime state.
75 let mut state_table = write_txn
76 .open_table(SEQUENCE_STATE)
77 .map_err(|e| catalog_err("open sequence_state", e))?;
78 let _ = state_table.remove(key.as_str());
79 }
80 write_txn.commit().map_err(|e| catalog_err("commit", e))?;
81 Ok(existed)
82 }
83
84 /// Load all sequences for a tenant.
85 pub fn load_sequences_for_tenant(&self, tenant_id: u64) -> crate::Result<Vec<StoredSequence>> {

Callers 3

deleteFunction · 0.80
drop_collectionFunction · 0.80
drop_sequenceFunction · 0.80

Calls 6

sequence_keyFunction · 0.85
begin_writeMethod · 0.80
catalog_errFunction · 0.70
removeMethod · 0.45
as_strMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected