Skip to main content

compact_segment

Function compact_segment 

Source
pub fn compact_segment(
    segment_data: &[u8],
    deletes: &DeleteBitmap,
    schema: &ColumnarSchema,
    profile_tag: u8,
    governor: Option<&Arc<MemoryGovernor>>,
    kek: Option<&WalEncryptionKey>,
) -> Result<CompactionResult, ColumnarError>
Expand description

Compact a single segment by removing deleted rows.

Reads the segment, skips rows marked in the delete bitmap, and writes a new segment with only live rows. Returns None segment if all rows were deleted.

When kek is Some, the output segment is wrapped in an AES-256-GCM SEGC envelope. The input segment must be plaintext (the caller is responsible for decrypting before passing to this function).

governor is optional: when Some, working-buffer allocations are tracked against the Columnar engine budget. Pass None in embedded (Lite) deployments where no governor is configured.