pub struct ReplicationInfo { /* private fields */ }Expand description
Implementação thread-safe da interface ReplicationInfo.
Utiliza um RwLock para garantir acesso seguro de múltiplas threads.
Esta implementação fornece:
- Acesso thread-safe através de
RwLock - Operações atômicas para get/set de progresso e máximo
- Métodos de conveniência para operações comuns
Implementations§
Source§impl ReplicationInfo
impl ReplicationInfo
Sourcepub async fn clone_with_values(&self) -> Self
pub async fn clone_with_values(&self) -> Self
Cria um clone que preserva os valores atuais. Esta é uma operação assíncrona pois precisa ler o estado atual.
Source§impl ReplicationInfo
impl ReplicationInfo
Sourcepub fn with_values(progress: usize, max: usize) -> Self
pub fn with_values(progress: usize, max: usize) -> Self
Cria uma nova instância com valores iniciais.
Sourcepub async fn increment_progress(&self)
pub async fn increment_progress(&self)
Incrementa o progresso em 1. Conveniência para operações de incremento simples.
Sourcepub async fn increment_progress_by(&self, amount: usize)
pub async fn increment_progress_by(&self, amount: usize)
Incrementa o progresso por um valor específico. Usa saturating_add para evitar overflow.
Sourcepub async fn is_complete(&self) -> bool
pub async fn is_complete(&self) -> bool
Retorna se a replicação está completa (progress >= max).
Sourcepub async fn progress_ratio(&self) -> f64
pub async fn progress_ratio(&self) -> f64
Retorna o percentual de progresso (0.0 a 1.0). Retorna 0.0 se max for 0.
Sourcepub async fn progress_percentage(&self) -> u8
pub async fn progress_percentage(&self) -> u8
Retorna o percentual de progresso (0 a 100). Retorna 0 se max for 0.
Sourcepub async fn get_progress_and_max(&self) -> (usize, usize)
pub async fn get_progress_and_max(&self) -> (usize, usize)
Obtém tanto o progresso quanto o máximo em uma única operação. Mais eficiente que chamadas separadas quando ambos os valores são necessários.
Sourcepub async fn set_progress_and_max(&self, progress: usize, max: usize)
pub async fn set_progress_and_max(&self, progress: usize, max: usize)
Define tanto o progresso quanto o máximo em uma única operação atômica. Mais eficiente que chamadas separadas.
Sourcepub async fn increment_max(&self, amount: usize)
pub async fn increment_max(&self, amount: usize)
Aplica um incremento ao máximo, usado quando novos itens são descobertos.
Trait Implementations§
Source§impl Clone for ReplicationInfo
impl Clone for ReplicationInfo
Source§impl Debug for ReplicationInfo
impl Debug for ReplicationInfo
Source§impl Default for ReplicationInfo
impl Default for ReplicationInfo
Source§fn default() -> ReplicationInfo
fn default() -> ReplicationInfo
Source§impl ReplicationInfo for ReplicationInfo
impl ReplicationInfo for ReplicationInfo
Source§async fn get_progress(&self) -> usize
async fn get_progress(&self) -> usize
Source§async fn set_progress(&self, i: usize)
async fn set_progress(&self, i: usize)
Auto Trait Implementations§
impl !Freeze for ReplicationInfo
impl !RefUnwindSafe for ReplicationInfo
impl Send for ReplicationInfo
impl Sync for ReplicationInfo
impl Unpin for ReplicationInfo
impl !UnwindSafe for ReplicationInfo
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> 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>
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>
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