Skip to main content

CascadeResolverN

Struct CascadeResolverN 

Source
pub struct CascadeResolverN<T: Copy + Default + 'static, const DEPTH: usize> {
    pub intermediate: Vec<SharedRegion<u32>>,
    pub leaf: SharedRegion<T>,
    /* private fields */
}
Expand description

Generic N-level resolver: caller provides a sequence of SharedRegions, one per non-leaf level holding intermediate cascade pointers, plus the leaf region holding T. Resolution walks the indices array level-by-level.

This is the explicit-walk variant. For a more ergonomic 4-level MMU-shaped resolver, callers can wrap this in their own type.

Fields§

§intermediate: Vec<SharedRegion<u32>>

Intermediate regions, one per non-leaf level. Each holds a flat u32 (the next level’s index). For depth N, this has length N-1.

§leaf: SharedRegion<T>

Leaf region holding T.

Implementations§

Source§

impl<T: Copy + Default + 'static, const DEPTH: usize> CascadeResolverN<T, DEPTH>

Source

pub fn create( leaf_path: impl AsRef<Path>, leaf_capacity: usize, intermediate_paths_and_caps: Vec<(PathBuf, usize)>, ) -> Result<Self, CascadeError>

Source

pub fn open( leaf_path: impl AsRef<Path>, leaf_capacity: usize, intermediate_paths_and_caps: Vec<(PathBuf, usize)>, ) -> Result<Self, CascadeError>

Source

pub fn allocate_leaf(&self, value: T) -> Result<u32, CascadeError>

Allocate a T value at the leaf and return its cascade. The caller is responsible for populating the intermediate levels (e.g., by treating outer indices as slot positions that reference the next-level slot to descend into).

For the simplest case where each level’s “index” is just the slot position in the corresponding intermediate region, use insert_path which performs the full descent.

Source

pub fn insert_at_top( &self, top_idx: u32, value: T, ) -> Result<KTowerCascade<T, DEPTH>, CascadeError>

Insert at a chosen TOP-LEVEL slot. Every intermediate level and the leaf are auto-allocated to fresh slots. Returns the full cascade. Calling twice with the same top_idx will OVERWRITE the previous top-level chain (the orphaned intermediates remain in their regions but become unreachable from top_idx).

For independent insertions, use distinct top_idx values (typically cascade_count, i.e. the next free top slot, which can be obtained as intermediate[0].len() as u32).

Source

pub fn append(&self, value: T) -> Result<KTowerCascade<T, DEPTH>, CascadeError>

Append a fresh entry. Picks the next free top slot automatically. Equivalent to insert_at_top(intermediate[0].len() as u32, value) for DEPTH > 1, or (allocate leaf, return its index) for DEPTH=1.

Source

pub fn get(&self, c: KTowerCascade<T, DEPTH>) -> Result<T, CascadeError>

Resolve a cascade to its T value by walking the levels.

Source

pub fn flush(&self) -> Result<(), CascadeError>

Trait Implementations§

Source§

impl<T: Copy + Default + Send + Sync + 'static, const DEPTH: usize> AdaptiveInstance for CascadeResolverN<T, DEPTH>

Source§

fn header(&self) -> &HandshakeHeader

Source§

fn ring(&self) -> &ObservationRing

Source§

fn make_policy(&self) -> Box<dyn Policy>

Source§

fn apply_migration(&self, new_tag: u32)

Called by the sidecar when the policy returns a new strategy tag. Default implementation: just set the tag on the header. Primitives that need heavier migration (data-layout swap) override this to perform the swap before (or after) updating the tag.

Auto Trait Implementations§

§

impl<T, const DEPTH: usize> !Freeze for CascadeResolverN<T, DEPTH>

§

impl<T, const DEPTH: usize> !UnwindSafe for CascadeResolverN<T, DEPTH>

§

impl<T, const DEPTH: usize> RefUnwindSafe for CascadeResolverN<T, DEPTH>

§

impl<T, const DEPTH: usize> Send for CascadeResolverN<T, DEPTH>
where SharedRegion<T>: Send,

§

impl<T, const DEPTH: usize> Sync for CascadeResolverN<T, DEPTH>
where SharedRegion<T>: Sync,

§

impl<T, const DEPTH: usize> Unpin for CascadeResolverN<T, DEPTH>
where SharedRegion<T>: Unpin,

§

impl<T, const DEPTH: usize> UnsafeUnpin for CascadeResolverN<T, DEPTH>

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.