pub struct SwitchoverBuffer { /* private fields */ }Expand description
Switchover buffer for zero-downtime primary transitions
Implementations§
Source§impl SwitchoverBuffer
impl SwitchoverBuffer
Sourcepub fn new(config: BufferConfig) -> Self
pub fn new(config: BufferConfig) -> Self
Create a new switchover buffer
Sourcepub fn is_buffering(&self) -> bool
pub fn is_buffering(&self) -> bool
Check if currently buffering
Sourcepub fn state(&self) -> BufferState
pub fn state(&self) -> BufferState
Get current state
Sourcepub fn subscribe(&self) -> Receiver<BufferState>
pub fn subscribe(&self) -> Receiver<BufferState>
Subscribe to state changes
Sourcepub fn start_buffering(&self)
pub fn start_buffering(&self)
Start buffering (called when switchover begins)
Sourcepub fn stop_buffering(&self)
pub fn stop_buffering(&self)
Stop buffering (called when switchover completes or fails)
Sourcepub fn buffer_query(
&self,
sql: String,
params: Vec<Vec<u8>>,
client_id: u64,
) -> Result<Receiver<BufferResult>>
pub fn buffer_query( &self, sql: String, params: Vec<Vec<u8>>, client_id: u64, ) -> Result<Receiver<BufferResult>>
Buffer a query (returns receiver for result)
Sourcepub async fn drain<F, Fut>(&self, execute_fn: F)
pub async fn drain<F, Fut>(&self, execute_fn: F)
Drain buffer and replay queries to new primary
The execute_fn is called for each buffered query to execute it
against the new primary.
Sourcepub fn stats(&self) -> BufferStatsSnapshot
pub fn stats(&self) -> BufferStatsSnapshot
Get buffer statistics
Auto Trait Implementations§
impl !Freeze for SwitchoverBuffer
impl !RefUnwindSafe for SwitchoverBuffer
impl Send for SwitchoverBuffer
impl Sync for SwitchoverBuffer
impl Unpin for SwitchoverBuffer
impl UnsafeUnpin for SwitchoverBuffer
impl !UnwindSafe for SwitchoverBuffer
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