pub struct SpaceLedger { /* private fields */ }Expand description
The server-wide account of bytes promised to transfers still landing.
One per data root; gunnar serve builds it with the disk-headroom gate and
hands the same Arc to every door that writes (push, mirror, LFS).
Implementations§
Source§impl SpaceLedger
impl SpaceLedger
Sourcepub fn new(root: impl Into<PathBuf>, floor: DiskFloor) -> Self
pub fn new(root: impl Into<PathBuf>, floor: DiskFloor) -> Self
The ledger for the data set root lives on, measured with statvfs.
Sourcepub fn with_probe(
root: impl Into<PathBuf>,
floor: DiskFloor,
probe: Arc<dyn SpaceProbe>,
) -> Self
pub fn with_probe( root: impl Into<PathBuf>, floor: DiskFloor, probe: Arc<dyn SpaceProbe>, ) -> Self
The same, measured by probe — a test’s fake disk.
Sourcepub fn with_fs_slack(self, slack: FsSlack) -> Self
pub fn with_fs_slack(self, slack: FsSlack) -> Self
Promise the filesystem’s slack as measured (FsSlack::of) instead of the floor
(PUSH_FS_SLACK_PERMILLE). gunnar serve measures its data set once at start.
Sourcepub fn with_small_lane(self, bytes: u64) -> Self
pub fn with_small_lane(self, bytes: u64) -> Self
Keep bytes above the floor for small pushes instead of
SMALL_PUSH_LANE. 0 turns the lane off.
Sourcepub fn small_lane(&self) -> u64
pub fn small_lane(&self) -> u64
The small-push lane in force.
Sourcepub fn probe(&self) -> &Arc<dyn SpaceProbe> ⓘ
pub fn probe(&self) -> &Arc<dyn SpaceProbe> ⓘ
The probe it measures with — the disk gate’s headroom reads the same.
Sourcepub fn hold(self: &Arc<Self>, copies: u64) -> SpaceHold
pub fn hold(self: &Arc<Self>, copies: u64) -> SpaceHold
A promise for one transfer, held to copies bytes of /data per byte
it sends (PUSH_COPIES for a framed push). Everything it still holds
is given back when it drops — landed, refused, cut or crashed.
Sourcepub fn full_before_the_first_byte(&self) -> Option<String>
pub fn full_before_the_first_byte(&self) -> Option<String>
The up-front line, before any byte: Some when what is promised
already covers everything above the floor. The floor gate’s own line
(under the floor with nothing promised) is the gate’s, not this.
The pusher is told in plain words; the numbers go to the journal (wiring tracer B 2026-10-08: a customer never sees room left).