Skip to main content

write_segment

Function write_segment 

Source
pub async fn write_segment<S: StorageEngine>(
    storage: &Arc<S>,
    name: &str,
    seg_id: u64,
    schema_hash: u64,
    tiles: &[(TileId, &SparseTile)],
) -> Result<Vec<u8>, LiteError>
Expand description

Flush a batch of (TileId, SparseTile) pairs into a new segment and persist the bytes.

When as_array_segment_ext() is available (pagedb backend), the bytes are stored as an encrypted pagedb segment. Otherwise they are stored as a KV blob in the Array namespace.

Returns the serialized segment bytes so the caller can record the byte_len in the manifest without a second storage read.