Struct RadixPrefixIndex
pub struct RadixPrefixIndex<const MAX_NODES: usize> { /* private fields */ }Expand description
Fixed-capacity, zero-heap Radix Prefix Index.
Implementations§
§impl<const MAX_NODES: usize> RadixPrefixIndex<MAX_NODES>
impl<const MAX_NODES: usize> RadixPrefixIndex<MAX_NODES>
pub const fn new() -> RadixPrefixIndex<MAX_NODES>
pub const fn new() -> RadixPrefixIndex<MAX_NODES>
Creates a default RadixPrefixIndex.
pub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
node count.
pub fn match_longest_prefix(
&mut self,
prompt_tokens: &[u32],
current_epoch: u64,
out_pages: &mut [u32],
) -> Result<(u32, u32, usize), RadixError>
pub fn match_longest_prefix( &mut self, prompt_tokens: &[u32], current_epoch: u64, out_pages: &mut [u32], ) -> Result<(u32, u32, usize), RadixError>
Find the longest matching prefix for prompt_tokens.
Applies OSRP rule: if all prompt tokens match, the last token is excluded
from reusable_tokens to ensure decode computes fresh logits for generation.
Writes physical page IDs into out_pages.
Returns (matched_tokens, reusable_tokens, page_count).
pub fn insert_child_page(
&mut self,
parent_idx: Option<u16>,
tokens: &[u32],
page_id: u32,
current_epoch: u64,
) -> Result<u16, RadixError>
pub fn insert_child_page( &mut self, parent_idx: Option<u16>, tokens: &[u32], page_id: u32, current_epoch: u64, ) -> Result<u16, RadixError>
Insert a page of tokens as a child of parent (or root if None).
pub fn evict_lru_leaf(
&mut self,
pool: &mut BlockPool,
) -> Result<Option<u32>, RadixError>
pub fn evict_lru_leaf( &mut self, pool: &mut BlockPool, ) -> Result<Option<u32>, RadixError>
Evict the least-recently-used leaf node and return its physical page to pool.
pub fn repoint_page_references(
tables: &mut [&mut SequenceBlockTable],
duplicate_page: u32,
canonical_page: u32,
pool: &mut BlockPool,
) -> Result<usize, RadixError>
pub fn repoint_page_references( tables: &mut [&mut SequenceBlockTable], duplicate_page: u32, canonical_page: u32, pool: &mut BlockPool, ) -> Result<usize, RadixError>
Repoint occurrences of duplicate_page to canonical_page across live block tables.
Trait Implementations§
§impl<const MAX_NODES: usize> Debug for RadixPrefixIndex<MAX_NODES>
impl<const MAX_NODES: usize> Debug for RadixPrefixIndex<MAX_NODES>
§impl<const MAX_NODES: usize> Default for RadixPrefixIndex<MAX_NODES>
impl<const MAX_NODES: usize> Default for RadixPrefixIndex<MAX_NODES>
§fn default() -> RadixPrefixIndex<MAX_NODES>
fn default() -> RadixPrefixIndex<MAX_NODES>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<const MAX_NODES: usize> Freeze for RadixPrefixIndex<MAX_NODES>
impl<const MAX_NODES: usize> RefUnwindSafe for RadixPrefixIndex<MAX_NODES>
impl<const MAX_NODES: usize> Send for RadixPrefixIndex<MAX_NODES>
impl<const MAX_NODES: usize> Sync for RadixPrefixIndex<MAX_NODES>
impl<const MAX_NODES: usize> Unpin for RadixPrefixIndex<MAX_NODES>
impl<const MAX_NODES: usize> UnsafeUnpin for RadixPrefixIndex<MAX_NODES>
impl<const MAX_NODES: usize> UnwindSafe for RadixPrefixIndex<MAX_NODES>
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.