pub struct CdnBlockSync { /* private fields */ }Expand description
Manages the CDN sync task.
This is used, for example, in snarkos_node_rest to query how far along the CDN sync is.
Implementations§
Source§impl CdnBlockSync
impl CdnBlockSync
Sourcepub fn new<N: Network, C: ConsensusStorage<N>>(
base_url: Uri,
ledger: Ledger<N, C>,
shutdown: Arc<AtomicBool>,
) -> Self
pub fn new<N: Network, C: ConsensusStorage<N>>( base_url: Uri, ledger: Ledger<N, C>, shutdown: Arc<AtomicBool>, ) -> Self
Spawn a background task that loads blocks from a CDN into the ledger.
On success, this function returns the completed block height. On failure, this function returns the last successful block height (if any), along with the error.
Sourcepub fn is_done(&self) -> bool
pub fn is_done(&self) -> bool
Did the CDN sync finish?
Note: This can only return true if you call wait()
Sourcepub async fn wait(&self) -> Result<Result<u32, (u32, Error)>>
pub async fn wait(&self) -> Result<Result<u32, (u32, Error)>>
Wait for CDN sync to finish. Can only be called once.
pub async fn get_cdn_height(&self) -> Result<u32>
Auto Trait Implementations§
impl !Freeze for CdnBlockSync
impl !RefUnwindSafe for CdnBlockSync
impl Send for CdnBlockSync
impl Sync for CdnBlockSync
impl Unpin for CdnBlockSync
impl UnwindSafe for CdnBlockSync
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