(
backend: &RedbFtsBackend,
tid: u64,
collection: &str,
segment_id: &str,
)
| 86 | } |
| 87 | |
| 88 | pub(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. |
nothing calls this directly
no test coverage detected