Skip to main content

drain_splitdirfdstream

Function drain_splitdirfdstream 

Source
pub fn drain_splitdirfdstream<ObjectID: FsVerityHashValue>(
    repo: Arc<Repository<ObjectID>>,
    pipe_read: OwnedFd,
    dir_fds: Vec<OwnedFd>,
    diff_id: &OciDigest,
    zerocopy: bool,
    ctx: ImportContext,
) -> Result<(ObjectID, ImportStats, ImportContext)>
Expand description

Drain the splitdirfdstream pipe and write the resulting layer splitstream.

This is the blocking half of a layer-import operation — it should be run on a spawn_blocking thread so the pipe can fill concurrently with the producer.

§Arguments

  • repo — Repository to import into.
  • pipe_read — Read end of the splitdirfdstream pipe.
  • dir_fds — Sparse dirfds region passed wholesale by the transport layer. dir_fds[dirfd_index] resolves the real diff-directory fd for each Chunk::FileBackedData chunk. Dummy fds at gap slots are never opened.
  • diff_id — OCI diff-id of the layer (used as the stream content identifier).
  • zerocopy — If true, use reflink/zerocopy when storing large objects.
  • ctx — Import context (passed back to the caller on success).

§Returns

A tuple of (verity_hash, import_stats, import_context) on success.