pub struct Service { /* private fields */ }
Expand description
SnapshotService
implementation.
This controls taking snapshots and restoring from them.
Implementations
sourceimpl Service
impl Service
sourcepub fn new(params: ServiceParams) -> Result<Self, Error>
pub fn new(params: ServiceParams) -> Result<Self, Error>
Create a new snapshot service from the given parameters.
sourcepub fn reader(&self) -> RwLockReadGuard<'_, Option<LooseReader>>
pub fn reader(&self) -> RwLockReadGuard<'_, Option<LooseReader>>
Get a reference to the snapshot reader.
sourcepub fn take_snapshot(&self, client: &Client, num: u64) -> Result<(), Error>
pub fn take_snapshot(&self, client: &Client, num: u64) -> Result<(), Error>
Take a snapshot at the block with the given number. calling this while a restoration is in progress or vice versa will lead to a race condition where the first one to finish will have their produced snapshot overwritten.
sourcepub fn init_restore(
&self,
manifest: ManifestData,
recover: bool
) -> Result<(), Error>
pub fn init_restore(
&self,
manifest: ManifestData,
recover: bool
) -> Result<(), Error>
Initialize the restoration synchronously. The recover flag indicates whether to recover the restored snapshot.
Trait Implementations
sourceimpl SnapshotService for Service
impl SnapshotService for Service
sourcefn manifest(&self) -> Option<ManifestData>
fn manifest(&self) -> Option<ManifestData>
Query the most recent manifest data.
sourcefn manifest_block(&self) -> Option<(u64, H256)>
fn manifest_block(&self) -> Option<(u64, H256)>
Query the most recent snapshoted block number and hash.
sourcefn supported_versions(&self) -> Option<(u64, u64)>
fn supported_versions(&self) -> Option<(u64, u64)>
Get the supported range of snapshot version numbers.
None
indicates warp sync isn’t supported by the consensus engine. Read more
sourcefn completed_chunks(&self) -> Option<Vec<H256>>
fn completed_chunks(&self) -> Option<Vec<H256>>
Returns a list of the completed chunks
sourcefn creation_status(&self) -> CreationStatus
fn creation_status(&self) -> CreationStatus
Ask the snapshot service for the creation status.
sourcefn restoration_status(&self) -> RestorationStatus
fn restoration_status(&self) -> RestorationStatus
Ask the snapshot service for the restoration status.
sourcefn begin_restore(&self, manifest: ManifestData)
fn begin_restore(&self, manifest: ManifestData)
Begin snapshot restoration. If restoration in-progress, this will reset it. From this point on, any previous snapshot may become unavailable. Read more
sourcefn abort_restore(&self)
fn abort_restore(&self)
Abort an in-progress restoration if there is one.
sourcefn restore_state_chunk(&self, hash: H256, chunk: Bytes)
fn restore_state_chunk(&self, hash: H256, chunk: Bytes)
Feed a raw state chunk to the service to be processed asynchronously. no-op if not currently restoring. Read more
sourcefn restore_block_chunk(&self, hash: H256, chunk: Bytes)
fn restore_block_chunk(&self, hash: H256, chunk: Bytes)
Feed a raw block chunk to the service to be processed asynchronously. no-op if currently restoring. Read more
sourcefn abort_snapshot(&self)
fn abort_snapshot(&self)
Abort in-progress snapshotting if there is one.
Auto Trait Implementations
impl !RefUnwindSafe for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl !UnwindSafe for Service
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more