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

Method compact_commit

nodedb/src/engine/sparse/inverted/compaction.rs:21–36  ·  view source on GitHub ↗

Atomically write a new merged FTS segment and remove the source segments that were merged into it, in one redb write transaction. Crash-safe: if the process terminates before the commit, the original segments remain intact for the next maintenance pass. The single transaction also guarantees that no reader observes both the new and the old segments simultaneously.

(
        &self,
        tid: TenantId,
        collection: &str,
        new_segment_id: &str,
        new_segment_data: &[u8],
        merged_ids: &[String],
    )

Source from the content-addressed store, hash-verified

19 /// transaction also guarantees that no reader observes both the new and
20 /// the old segments simultaneously.
21 pub fn compact_commit(
22 &self,
23 tid: TenantId,
24 collection: &str,
25 new_segment_id: &str,
26 new_segment_data: &[u8],
27 merged_ids: &[String],
28 ) -> crate::Result<()> {
29 self.inner.backend().compact_commit(
30 tid.as_u64(),
31 collection,
32 new_segment_id,
33 new_segment_data,
34 merged_ids,
35 )
36 }
37
38 /// Enumerate every `(TenantId, collection)` pair that has at least one
39 /// FTS segment in the backing store.

Callers 1

Calls 2

backendMethod · 0.45
as_u64Method · 0.45

Tested by

no test coverage detected