pub struct CacheCoherenceProtocol { /* private fields */ }Expand description
缓存一致性协议
Implementations§
Source§impl CacheCoherenceProtocol
impl CacheCoherenceProtocol
Sourcepub fn new(
instance_id: String,
strategy: ConsistencyStrategy,
broadcaster: Arc<dyn InvalidationBroadcaster>,
) -> Self
pub fn new( instance_id: String, strategy: ConsistencyStrategy, broadcaster: Arc<dyn InvalidationBroadcaster>, ) -> Self
创建新的一致性协议实例
Sourcepub fn read(&self, key: &str, other_instances_have: bool) -> MesiState
pub fn read(&self, key: &str, other_instances_have: bool) -> MesiState
读操作(触发状态转换:Invalid→Exclusive/Shared)
Sourcepub fn handle_invalidation(&self, event: &InvalidationEvent)
pub fn handle_invalidation(&self, event: &InvalidationEvent)
处理收到的失效广播(→Invalid)
Sourcepub fn metrics(&self) -> CoherenceMetrics
pub fn metrics(&self) -> CoherenceMetrics
获取指标快照
Sourcepub fn strategy(&self) -> ConsistencyStrategy
pub fn strategy(&self) -> ConsistencyStrategy
获取写策略
Auto Trait Implementations§
impl !Freeze for CacheCoherenceProtocol
impl !RefUnwindSafe for CacheCoherenceProtocol
impl !UnwindSafe for CacheCoherenceProtocol
impl Send for CacheCoherenceProtocol
impl Sync for CacheCoherenceProtocol
impl Unpin for CacheCoherenceProtocol
impl UnsafeUnpin for CacheCoherenceProtocol
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> 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