Skip to main content

Module transport

Module transport 

Source
Expand description

Source-agnostic FD-transport mechanics for the splitdirfdstream wire protocol.

This module contains the pure, Storage/Layer-independent helpers that govern how a set of file descriptors is partitioned into transport frames and how the sparse dirfd-slot layout is computed. Both the composefs-storage layer-transfer producer and future producers (e.g. a composefs-repo producer) can share these primitives without pulling in any higher-level dependencies.

§Public API

ItemRole
MAX_FDS_PER_FRAMEEnforced per-frame fd cap (240, safely below 253).
seed_from_idDerive a deterministic u64 seed from an opaque string id.
open_devnullOpen /dev/null for use as a dummy fd.
FdLimitErrorError from split_fds_into_frames when more=false overflows.
LayerFdLayoutComplete assembled wire layout from build_layer_fd_layout.
build_layer_fd_layoutAssemble the full sparse dirfd+keepalive+lifetime fd array.
split_fds_into_framesPartition fds into frames, enforcing more=false cap.
[spawn_self_reaping_producer]Spawn the 3-phase keepalive-lock producer task (requires tokio feature).

The producer-side seed jitter (sparse-slot placement, frame count, extra lifetime fds) is computed by crate-internal helpers (sparse_dir_slots, compute_n_frames, n_extra_lifetime_fds); the consumer never recomputes it, since every FileBackedData chunk carries an explicit dirfd_index.

Structs§

FdLimitError
Error returned by split_fds_into_frames when more=false and the fd count exceeds MAX_FDS_PER_FRAME.
LayerFdLayout
Assembled FD layout ready to wire to the client in one or more transport frames.

Constants§

MAX_FDS_PER_FRAME
Our enforced per-frame fd cap.

Functions§

build_layer_fd_layout
Build the complete wire fd layout for a producer serving n_real real diff directories.
open_devnull
Open /dev/null as an opaque dummy fd.
seed_from_id
Derive a deterministic u64 seed from an opaque string identifier.
split_fds_into_frames
Partition a complete fd array into transport frames.