Skip to main content

run_snapshot_session

Function run_snapshot_session 

Source
pub fn run_snapshot_session<Reader, Writer, EventSink, Verifier, VerifyError>(
    server_reader: &mut Reader,
    client_writer: &mut Writer,
    request: SnapshotSessionRequest<'_>,
    artifact_spool: &mut CreateOnlyArtifactSpool,
    on_event: EventSink,
    verify_artifact: Verifier,
) -> Result<SnapshotSessionOutcome, SnapshotSessionClientError>
where Reader: Read, Writer: Write, EventSink: FnMut(RemoteBuildEvent), Verifier: FnOnce(&mut File, &Utf8Path, &SnapshotArtifactDescriptor) -> Result<ProtocolPath, VerifyError>,
Expand description

Run one pure framed snapshot session over caller-owned duplex streams.

Source and artifact payloads are streamed with fixed memory. verify_artifact runs after the artifact’s size and SHA-256 match its descriptor and must return the final client-absolute path. Client receipt frame three is written only after the final path is opened without following a final symlink, proven to be the verified inode, and durably synchronized.

A successful return authorizes, but does not commit, the artifact. The caller must invoke CreateOnlyArtifactSpool::commit after its own supporting-output checks; otherwise Drop removes the uncommitted output.

§Errors

Fails closed on any framing, order, identity, digest, file-stability, verifier, server-error, or cleanup mismatch.