Skip to main content

HandleTable

Struct HandleTable 

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

Per-task handle table. M3 makes the context manager’s partitions a view over this.

Implementations§

Source§

impl HandleTable

Source

pub fn new() -> Self

Source

pub fn insert(&mut self, handle: Handle)

Source

pub fn get(&self, id: HandleId) -> Option<&Handle>

Source

pub fn get_mut(&mut self, id: HandleId) -> Option<&mut Handle>

Source

pub fn all(&self) -> &[Handle]

Source

pub fn all_mut(&mut self) -> &mut [Handle]

Source

pub fn retain(&mut self, keep: impl FnMut(&Handle) -> bool)

Retain only the handles for which keep returns true; drop the rest. The GC primitive the context manager uses to evict handles whose backing message has left working context (archived by compression / dropped on renewal) — bounding the table to the working set instead of growing with total session length.

Source

pub fn residency_for_source(&self, source: &str) -> Option<&Residency>

Residency of the handle anchored to source (e.g. a tool call_id), if any. The renderer uses this to project a tool result without touching the stored message.

Source

pub fn tool_result_handles_mut(&mut self) -> impl Iterator<Item = &mut Handle>

Tool-result handles in insertion (recency) order — oldest first. Used by the residency planner to decide which older results to project out under context pressure.

Source

pub fn resident_tokens(&self) -> u32

Sum of tokens for handles still occupying working context.

Source

pub fn non_resident_tokens(&self) -> u32

Sum of tokens for handles that have left working context (Collapsed / SpooledOut / PagedOut). Their anchored messages still sit in partitions at full weight (collapse is non-destructive), so this is exactly the over-count that the estimate rho path must discount to become paging-aware — see [crate::context::manager::ContextManager::effective_rho].

Trait Implementations§

Source§

impl Clone for HandleTable

Source§

fn clone(&self) -> HandleTable

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HandleTable

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for HandleTable

Source§

fn default() -> HandleTable

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

impl<'de> Deserialize<'de> for HandleTable

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for HandleTable

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.