Rindle docs and package mapSkip to main content

DeltaBudget

Struct DeltaBudget 

Source
pub struct DeltaBudget { /* private fields */ }
Expand description

The derivation memory budget (design 306 D4) — what bounds a batch delta, in place of a row count.

A row count is not a memory bound: rows are variable-length Arc<[u8]>, so 1M rows is ~190 MiB of 100-byte rows or ~1.2 GiB of 1 KiB rows, and the cap that protects the first OOMs on the second. This tracks estimated bytes, charged as rows enter the delta’s trees and released as they leave, so the ceiling means the same thing for every schema.

One budget spans every table in the transaction. rindle-replica’s Engine hands the same Rc<DeltaBudget> to each registered table’s delta, so a write touching 20 tables is bounded by the budget, not by 20× it. (Threads do not share: a cluster’s worker engines each get their own, so a process ceiling is workers × max_bytes — tune per-worker, not per-process.)

The number is an accounted upper bound, not a measurement. It sums, per delta: row_bytes once per distinct row buffer the delta holds (in touched, the superset — primary and the secondaries share those same Arcs), plus TREE_ENTRY_BYTES per tree slot across touched, primary, and each secondary index. It does not model allocator fragmentation or the connection’s own SQLite pager, and it deliberately rounds against itself. tests/delta_budget_alloc_probe.rs pins it against a live-bytes global allocator and fails the build if it ever drops below what the heap actually retains.

Implementations§

Source§

impl DeltaBudget

Source

pub fn new(max_bytes: usize) -> DeltaBudget

A budget of max_bytes, nothing charged against it yet.

Source

pub fn set_max_bytes(&self, max_bytes: usize)

Re-tune the ceiling. Takes effect at the next overflow check; safe on a live, shared budget — the limit is only ever read, never part of any structure.

Source

pub fn max_bytes(&self) -> usize

The current ceiling.

Source

pub fn used(&self) -> usize

Estimated bytes currently held across every delta sharing this budget.

Trait Implementations§

Source§

impl Default for DeltaBudget

Source§

fn default() -> Self

Returns the “default value” for a type. 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<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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

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

§

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

§

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