Skip to main content

SpaceLedger

Struct SpaceLedger 

Source
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

Source

pub fn new(root: impl Into<PathBuf>, floor: DiskFloor) -> Self

The ledger for the data set root lives on, measured with statvfs.

Source

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.

Source

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.

Source

pub fn fs_slack(&self) -> FsSlack

The filesystem’s slack in force.

Source

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.

Source

pub fn root(&self) -> &Path

The data root this ledger speaks for (named in its refusals).

Source

pub fn floor(&self) -> DiskFloor

The floor it keeps.

Source

pub fn small_lane(&self) -> u64

The small-push lane in force.

Source

pub fn probe(&self) -> &Arc<dyn SpaceProbe> ⓘ

The probe it measures with — the disk gate’s headroom reads the same.

Source

pub fn reserved(&self) -> u64

Bytes promised right now and not on the disk yet.

Source

pub fn holds(&self) -> usize

Transfers holding a promise right now.

Source

pub fn refused(&self) -> u64

Transfers refused for room since this ledger was built.

Source

pub fn standing(&self) -> Result<Standing>

One measurement, with the promises beside it.

Source

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.

Source

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).

Trait Implementations§

Source§

impl Debug for SpaceLedger

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more