Skip to main content

write_bundle_streaming

Function write_bundle_streaming 

Source
pub fn write_bundle_streaming<W, S>(
    out: W,
    created_at: u64,
    data_only: bool,
    source: SourceInfo,
    specs: Vec<MemberSpec>,
    stage: S,
) -> Result<(), BundleError>
Expand description

Stream a v2 bundle to out, producing each member JUST BEFORE it is appended and freeing its staging temp JUST AFTER — so the transient on-disk staging never exceeds the largest single member (O(largest member), never O(whole bundle)). For each MemberSpec in specs (restore order), stage(spec) stages THAT member to a temp and returns its path; the member is appended (sidecar + data) and its temp is then deleted before the next is staged.

This is the shape the export driver uses from its blocking task: stage runs the engine dump (pg_dump / libsql VACUUM INTO / the KV slice / a blob get) into a staging temp, one member at a time.