pub struct ProgressTracker { /* private fields */ }Expand description
Implementations§
Source§impl ProgressTracker
impl ProgressTracker
Sourcepub fn new(notif_tx: UnboundedSender<JsonRpcNotification>) -> Self
pub fn new(notif_tx: UnboundedSender<JsonRpcNotification>) -> Self
Create a new progress tracker
§Arguments
notif_tx- Notification channel for sending progress updates
Sourcepub fn start(&self, op_type: &str, total: u32) -> ProgressToken
pub fn start(&self, op_type: &str, total: u32) -> ProgressToken
Sourcepub fn progress(&self, token: &ProgressToken, current: u32) -> bool
pub fn progress(&self, token: &ProgressToken, current: u32) -> bool
Sourcepub fn finish(&self, token: &ProgressToken)
pub fn finish(&self, token: &ProgressToken)
Mark operation complete (final notification at 100%)
Removes the operation from tracking and sends final progress notification.
§Arguments
token- Progress token fromstart()
Sourcepub fn cleanup_stale(&self)
pub fn cleanup_stale(&self)
Clean up stale operations (older than 10 minutes)
Call periodically from background tasks. Only performs cleanup if at least 60 seconds have passed since last cleanup.
Trait Implementations§
Source§impl Clone for ProgressTracker
impl Clone for ProgressTracker
Source§fn clone(&self) -> ProgressTracker
fn clone(&self) -> ProgressTracker
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ProgressTracker
impl !RefUnwindSafe for ProgressTracker
impl Send for ProgressTracker
impl Sync for ProgressTracker
impl Unpin for ProgressTracker
impl !UnwindSafe for ProgressTracker
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