pub struct SpaceHold { /* private fields */ }Expand description
One transfer’s promise. Asked before each chunk (Self::admit),
told as its copies land (Self::realize), given back when it drops.
Implementations§
Source§impl SpaceHold
impl SpaceHold
Sourcepub fn admit(&self, want: u64) -> Result<u64, String>
pub fn admit(&self, want: u64) -> Result<u64, String>
May this transfer take up to want more wire bytes? Ok(n) with
0 < n ≤ want grants n (promising copies × n of /data); Err(line)
refuses the transfer — for good: every later ask is the same Err, and
everything it held is given back now, before its spool is even gone.
Sourcepub fn admit_all(&self, bytes: u64) -> Result<(), String>
pub fn admit_all(&self, bytes: u64) -> Result<(), String>
All of bytes, or a refusal — a transfer that declares its size
up front (an LFS object). Partial room is no room here.
Sourcepub fn realize(&self, bytes: u64)
pub fn realize(&self, bytes: u64)
bytes of what this transfer promised are on the disk now, where
statvfs counts them — so they stop being counted twice. Call it after
the write returns, never before: a promise released early is a byte
nobody counts.
Sourcepub fn per_mille(&self) -> u64
pub fn per_mille(&self) -> u64
What this hold promises per wire byte, ‰: its copies with the filesystem’s slack
(SpaceLedger::fs_slack; the floor PUSH_FS_SLACK_PERMILLE unless measured).
Sourcepub fn promise_for(&self, wire: u64) -> u64
pub fn promise_for(&self, wire: u64) -> u64
The bytes of /data wire wire bytes are promised: Self::per_mille, rounded up. What
lands is given back by Self::realize; the slack is given back when the hold drops.
Sourcepub fn full_now(&self) -> String
pub fn full_now(&self) -> String
The line for a store that ran out of room anyway — an ENOSPC the
admission did not foresee (a writer outside the ledger). Said in the
same words, with the numbers as they are now, so a client is never told
uring: op failed: Operation canceled.
Sourcepub fn at_the_floor(&self, freed: u64) -> bool
pub fn at_the_floor(&self, freed: u64) -> bool
Was the data set at its floor when this transfer failed — free now,
less the freed bytes its own failure just gave back (its spool), at
or under the floor? An unmeasurable disk counts as yes. What a store
failure that does not SAY “no space” (io_uring’s Operation canceled
for a linked chain whose head hit ENOSPC) is judged by.