Skip to main content

DirectorPool

Struct DirectorPool 

Source
pub struct DirectorPool<I: IndexLike = u32, const TRACK: bool = true, const PROOFS: bool = false> { /* private fields */ }
Expand description

Semi-persistent spill pool for oversized director matrices.

Each entry is length-prefixed: pool[start] = bit_length (as PoolDirector) pool[start+1..] = matrix data, ceil(bit_length / 63) words

The working pool is a VecI<PoolDirector, I, TRACK> — supports in-place mutation (for re-canonization during rebuild) with capture tracking.

When PROOFS = true, a separate append-only proof pool snapshots spilled matrices at copy-on-first-recanonicalization time. The proof pool is never truncated during working rollback.

§Index width

I is the pool’s index word. It was hard-coded to u32, capping the pool at 4 G words (32 GB) whatever id family the session configured — a ceiling a 63-bit configuration can reach. The word is also what the capture journal stores per touched entry, so it should be the narrowest type that spans the pool, not usize. A tighter bound applies from the other side: a Director<W> names an entry in W::BITS - 1 bits (see Director::new_spilled), so an I wider than that buys nothing.

Implementations§

Source§

impl<I: IndexLike, const TRACK: bool, const PROOFS: bool> DirectorPool<I, TRACK, PROOFS>

Source

pub fn new() -> Self

Source

pub fn append(&mut self, bit_length: u32, data: &[PoolDirector]) -> I

Append a spilled matrix to the working pool. Returns the start index.

Growth past I’s range is caught by the container’s overflow protocol: push carries no check of its own, and the next len() read — the one this method starts with — traps.

Source

pub fn bit_length(&self, start: I) -> u32

Read bit_length from a working pool entry.

Source

pub fn get(&self, idx: I) -> PoolDirector

Get a single working pool word by index.

Source

pub fn set(&mut self, idx: I, val: PoolDirector)

Mutate a working pool word in place (for re-canonization).

Source

pub fn read(&self, start: I) -> (u32, Vec<PoolDirector>)

Read a spilled matrix from the working pool.

Source

pub fn len(&self) -> I

Current working pool length, in the pool’s index word.

Source

pub fn is_empty(&self) -> bool

Source

pub fn mark(&mut self, shrink: ShrinkPolicy) -> VecToken

Mark for semi-persistent checkpoint.

Source

pub fn restore(&mut self, token: VecToken)

Restore to a previous checkpoint.

Source

pub fn snapshot_to_proof(&mut self, work_start: I) -> I

Snapshot a spilled matrix into the proof pool (copy-on-first-recanon). Returns the start index in the proof pool.

The proof pool shares the working pool’s index word: both address the same spilled matrices, one live and one archived, so a start index that fits I in the working pool fits I here.

Source

pub fn read_proof(&self, start: I) -> (u32, Vec<PoolDirector>)

Read a spilled matrix from the proof pool.

Source

pub fn proof_len(&self) -> I

Proof pool length.

Trait Implementations§

Source§

impl<I: IndexLike, const TRACK: bool, const PROOFS: bool> Default for DirectorPool<I, TRACK, PROOFS>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<I, const TRACK: bool, const PROOFS: bool> Freeze for DirectorPool<I, TRACK, PROOFS>

§

impl<I, const TRACK: bool, const PROOFS: bool> RefUnwindSafe for DirectorPool<I, TRACK, PROOFS>

§

impl<I, const TRACK: bool, const PROOFS: bool> Send for DirectorPool<I, TRACK, PROOFS>

§

impl<I, const TRACK: bool, const PROOFS: bool> Sync for DirectorPool<I, TRACK, PROOFS>

§

impl<I, const TRACK: bool, const PROOFS: bool> Unpin for DirectorPool<I, TRACK, PROOFS>

§

impl<I, const TRACK: bool, const PROOFS: bool> UnsafeUnpin for DirectorPool<I, TRACK, PROOFS>

§

impl<I, const TRACK: bool, const PROOFS: bool> UnwindSafe for DirectorPool<I, TRACK, PROOFS>

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 = !

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.