pub struct OfflineQueue { /* private fields */ }Expand description
Offline request queue
Implementations§
Source§impl OfflineQueue
impl OfflineQueue
Sourcepub fn new(config: OfflineQueueConfig) -> Result<Self, OfflineQueueError>
pub fn new(config: OfflineQueueConfig) -> Result<Self, OfflineQueueError>
Create a new offline queue
Sourcepub fn enqueue(&self, request: QueuedRequest) -> Result<(), OfflineQueueError>
pub fn enqueue(&self, request: QueuedRequest) -> Result<(), OfflineQueueError>
Add a request to the queue
Sourcepub fn dequeue(&self) -> Option<QueuedRequest>
pub fn dequeue(&self) -> Option<QueuedRequest>
Get the next request to replay
Sourcepub fn mark_completed(&self, request_id: &str, success: bool)
pub fn mark_completed(&self, request_id: &str, success: bool)
Mark a request as completed
Sourcepub fn requeue(&self, request: QueuedRequest) -> Result<(), OfflineQueueError>
pub fn requeue(&self, request: QueuedRequest) -> Result<(), OfflineQueueError>
Requeue a failed request for retry
Sourcepub fn set_online(&self, online: bool)
pub fn set_online(&self, online: bool)
Set network online status
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Get number of pending requests
Sourcepub fn in_flight_count(&self) -> usize
pub fn in_flight_count(&self) -> usize
Get number of in-flight requests
Sourcepub fn cleanup_expired(&self)
pub fn cleanup_expired(&self)
Clean up expired requests
Sourcepub fn get_replay_batch(&self) -> Vec<QueuedRequest>
pub fn get_replay_batch(&self) -> Vec<QueuedRequest>
Get a batch of requests for replay
Sourcepub fn stats(&self) -> OfflineQueueStats
pub fn stats(&self) -> OfflineQueueStats
Get current statistics
Sourcepub fn reset_stats(&self)
pub fn reset_stats(&self)
Reset statistics
Auto Trait Implementations§
impl Freeze for OfflineQueue
impl !RefUnwindSafe for OfflineQueue
impl Send for OfflineQueue
impl Sync for OfflineQueue
impl Unpin for OfflineQueue
impl !UnwindSafe for OfflineQueue
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> 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
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