pub struct CacheSyncProtocol { /* private fields */ }Expand description
Tracks distributed cache state across all ranks.
This is a metadata-only coordinator. It does not hold actual tensors — tensors live in the inference engine’s KV cache on each device.
Implementations§
Source§impl CacheSyncProtocol
impl CacheSyncProtocol
Sourcepub fn with_max_log_size(self, max: usize) -> Self
pub fn with_max_log_size(self, max: usize) -> Self
Set the maximum event log size (oldest events are dropped).
Sourcepub fn record_event(&mut self, event: SyncEvent)
pub fn record_event(&mut self, event: SyncEvent)
Record a synchronisation event.
Sourcepub fn latest_position(&self, rank: usize, layer: usize) -> Option<usize>
pub fn latest_position(&self, rank: usize, layer: usize) -> Option<usize>
Latest known sequence position for a (rank, layer).
Sourcepub fn min_synced_position(&self, layer: usize) -> Option<usize>
pub fn min_synced_position(&self, layer: usize) -> Option<usize>
Minimum sequence position across all ranks for a given layer.
Returns None if any rank hasn’t reported for that layer.
This is the “safe” position up to which all ranks are in sync.
Sourcepub fn is_prefix_confirmed(&self, prefix_id: u64) -> bool
pub fn is_prefix_confirmed(&self, prefix_id: u64) -> bool
Whether a prefix is confirmed across all ranks.
Sourcepub fn prefix_tokens(&self, prefix_id: u64) -> Option<usize>
pub fn prefix_tokens(&self, prefix_id: u64) -> Option<usize>
Confirmed prefix token count—None if not confirmed.
Sourcepub fn event_count(&self) -> usize
pub fn event_count(&self) -> usize
Number of events recorded.
Sourcepub fn recent_events(&self, n: usize) -> &[SyncEvent]
pub fn recent_events(&self, n: usize) -> &[SyncEvent]
Recent events (up to n).
Trait Implementations§
Source§impl Clone for CacheSyncProtocol
impl Clone for CacheSyncProtocol
Auto Trait Implementations§
impl Freeze for CacheSyncProtocol
impl RefUnwindSafe for CacheSyncProtocol
impl Send for CacheSyncProtocol
impl Sync for CacheSyncProtocol
impl Unpin for CacheSyncProtocol
impl UnsafeUnpin for CacheSyncProtocol
impl UnwindSafe for CacheSyncProtocol
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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