pub struct ShadowConnection<C: Connection> { /* private fields */ }Expand description
双轨影子流量校验连接装饰器
包装 ORM 连接和原生连接,每次查询时同步执行两路并比较结果。
§线程安全
ShadowConnection 内部的 ORM 连接和原生连接都要求 Connection: Send + Sync,
因此 ShadowConnection 自动满足 Send + Sync。
Implementations§
Source§impl<C: Connection> ShadowConnection<C>
impl<C: Connection> ShadowConnection<C>
Sourcepub fn new(orm_conn: C, raw_conn: C, config: ShadowConfig) -> Self
pub fn new(orm_conn: C, raw_conn: C, config: ShadowConfig) -> Self
创建影子流量连接
Sourcepub fn with_mismatch_action(self, action: MismatchAction) -> Self
pub fn with_mismatch_action(self, action: MismatchAction) -> Self
设置不匹配行为
Sourcepub fn stats(&self) -> &ShadowStats
pub fn stats(&self) -> &ShadowStats
获取统计快照
Auto Trait Implementations§
impl<C> !Freeze for ShadowConnection<C>
impl<C> RefUnwindSafe for ShadowConnection<C>where
C: RefUnwindSafe,
impl<C> Send for ShadowConnection<C>
impl<C> Sync for ShadowConnection<C>
impl<C> Unpin for ShadowConnection<C>where
C: Unpin,
impl<C> UnsafeUnpin for ShadowConnection<C>where
C: UnsafeUnpin,
impl<C> UnwindSafe for ShadowConnection<C>where
C: UnwindSafe,
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
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