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

Function remove

nodedb/src/engine/sparse/fts_redb/backend/segments.rs:88–111  ·  view source on GitHub ↗
(
    backend: &RedbFtsBackend,
    tid: u64,
    collection: &str,
    segment_id: &str,
)

Source from the content-addressed store, hash-verified

86}
87
88pub(super) fn remove(
89 backend: &RedbFtsBackend,
90 tid: u64,
91 collection: &str,
92 segment_id: &str,
93) -> crate::Result<()> {
94 let write_txn = backend
95 .db
96 .begin_write()
97 .map_err(|e| redb_err("write txn", e))?;
98 {
99 let mut table = write_txn
100 .open_table(SEGMENTS)
101 .map_err(|e| redb_err("open segments", e))?;
102 // `Table::remove` returns `Result<Option<AccessGuard<V>>>` — propagate
103 // the error so a corrupt index or aborted txn surfaces; the absent-key
104 // case (`Ok(None)`) is intentionally a no-op, not an error.
105 table
106 .remove((tid, collection, segment_id))
107 .map_err(|e| redb_err("remove segment", e))?;
108 }
109 write_txn.commit().map_err(|e| redb_err("commit", e))?;
110 Ok(())
111}
112
113/// Atomically register a new merged segment and remove the source segments
114/// that were merged into it.

Callers

nothing calls this directly

Calls 4

begin_writeMethod · 0.80
redb_errFunction · 0.70
removeMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected