Struct grin_chain::types::SyncState
source · pub struct SyncState { /* private fields */ }
Expand description
Current sync state. Encapsulates the current SyncStatus.
Implementations§
source§impl SyncState
impl SyncState
sourcepub fn is_syncing(&self) -> bool
pub fn is_syncing(&self) -> bool
Whether the current state matches any active syncing operation. Note: This includes our “initial” state.
sourcepub fn status(&self) -> SyncStatus
pub fn status(&self) -> SyncStatus
Current syncing status
sourcepub fn update(&self, new_status: SyncStatus) -> bool
pub fn update(&self, new_status: SyncStatus) -> bool
Update the syncing status
sourcepub fn update_if<F>(&self, new_status: SyncStatus, f: F) -> bool
pub fn update_if<F>(&self, new_status: SyncStatus, f: F) -> bool
Update the syncing status if predicate f is satisfied
sourcepub fn update_header_sync(&self, new_sync_head: Tip)
pub fn update_header_sync(&self, new_sync_head: Tip)
Update sync_head if state is currently HeaderSync.
sourcepub fn update_txhashset_download(&self, stats: TxHashsetDownloadStats)
pub fn update_txhashset_download(&self, stats: TxHashsetDownloadStats)
Update txhashset downloading progress
sourcepub fn update_pibd_progress(
&self,
aborted: bool,
errored: bool,
completed_leaves: u64,
completed_to_height: u64,
archive_header: &BlockHeader
)
pub fn update_pibd_progress( &self, aborted: bool, errored: bool, completed_leaves: u64, completed_to_height: u64, archive_header: &BlockHeader )
Update PIBD progress
sourcepub fn add_pibd_segment(&self, id: &SegmentTypeIdentifier)
pub fn add_pibd_segment(&self, id: &SegmentTypeIdentifier)
Update PIBD segment list
sourcepub fn remove_pibd_segment(&self, id: &SegmentTypeIdentifier)
pub fn remove_pibd_segment(&self, id: &SegmentTypeIdentifier)
Remove segment from list
sourcepub fn remove_stale_pibd_requests(&self, timeout_seconds: i64)
pub fn remove_stale_pibd_requests(&self, timeout_seconds: i64)
Remove segments with request timestamps less than cutoff time
sourcepub fn contains_pibd_segment(&self, id: &SegmentTypeIdentifier) -> bool
pub fn contains_pibd_segment(&self, id: &SegmentTypeIdentifier) -> bool
Check whether segment is in request list
sourcepub fn set_sync_error(&self, error: Error)
pub fn set_sync_error(&self, error: Error)
Communicate sync error
sourcepub fn sync_error(&self) -> Option<String>
pub fn sync_error(&self) -> Option<String>
Get sync error
sourcepub fn clear_sync_error(&self)
pub fn clear_sync_error(&self)
Clear sync error
Trait Implementations§
source§impl TxHashsetWriteStatus for SyncState
impl TxHashsetWriteStatus for SyncState
source§fn on_setup(
&self,
headers: Option<u64>,
headers_total: Option<u64>,
kernel_pos: Option<u64>,
kernel_pos_total: Option<u64>
)
fn on_setup( &self, headers: Option<u64>, headers_total: Option<u64>, kernel_pos: Option<u64>, kernel_pos_total: Option<u64> )
First setup of the txhashset
source§fn on_validation_kernels(&self, kernels: u64, kernels_total: u64)
fn on_validation_kernels(&self, kernels: u64, kernels_total: u64)
Starting kernel validation
source§fn on_validation_rproofs(&self, rproofs: u64, rproofs_total: u64)
fn on_validation_rproofs(&self, rproofs: u64, rproofs_total: u64)
Starting rproof validation
Auto Trait Implementations§
impl !Freeze for SyncState
impl !RefUnwindSafe for SyncState
impl Send for SyncState
impl Sync for SyncState
impl Unpin for SyncState
impl UnwindSafe for SyncState
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