pub struct SnapshotClient { /* private fields */ }
Expand description
Aggregator client for the snapshot artifact
Implementations§
Source§impl SnapshotClient
impl SnapshotClient
Sourcepub fn new(
aggregator_client: Arc<dyn AggregatorClient>,
http_file_downloader: Arc<dyn FileDownloader>,
ancillary_verifier: Option<Arc<AncillaryVerifier>>,
feedback_sender: FeedbackSender,
logger: Logger,
) -> Self
pub fn new( aggregator_client: Arc<dyn AggregatorClient>, http_file_downloader: Arc<dyn FileDownloader>, ancillary_verifier: Option<Arc<AncillaryVerifier>>, feedback_sender: FeedbackSender, logger: Logger, ) -> Self
Constructs a new SnapshotClient
.
Sourcepub async fn list(&self) -> MithrilResult<Vec<SnapshotListItem>>
pub async fn list(&self) -> MithrilResult<Vec<SnapshotListItem>>
Return a list of available snapshots
Sourcepub async fn get(&self, digest: &str) -> MithrilResult<Option<Snapshot>>
pub async fn get(&self, digest: &str) -> MithrilResult<Option<Snapshot>>
Get the given snapshot data. If it cannot be found, a None is returned.
Sourcepub async fn download_unpack_full(
&self,
snapshot: &Snapshot,
target_dir: &Path,
) -> MithrilResult<()>
pub async fn download_unpack_full( &self, snapshot: &Snapshot, target_dir: &Path, ) -> MithrilResult<()>
Download and unpack the given snapshot, including its ancillary files, to the given directory
Ancillary files are the files that are not signed by Mithril but are needed to enable fast They include the last ledger state snapshot and the last immutable file.
NOTE: The target directory should already exist, and the user running the binary must have read/write access to it.
Sourcepub async fn download_unpack(
&self,
snapshot: &Snapshot,
target_dir: &Path,
) -> MithrilResult<()>
pub async fn download_unpack( &self, snapshot: &Snapshot, target_dir: &Path, ) -> MithrilResult<()>
Download and unpack the given immutable files of the snapshot to the given directory
Ancillary files are not included in this operation, if they are needed, use download_unpack_full instead.
NOTE: The target directory should already exist, and the user running the binary must have read/write access to it.
Sourcepub async fn add_statistics(&self, snapshot: &Snapshot) -> MithrilResult<()>
pub async fn add_statistics(&self, snapshot: &Snapshot) -> MithrilResult<()>
Increments the aggregator snapshot download statistics
Auto Trait Implementations§
impl Freeze for SnapshotClient
impl !RefUnwindSafe for SnapshotClient
impl Send for SnapshotClient
impl Sync for SnapshotClient
impl Unpin for SnapshotClient
impl !UnwindSafe for SnapshotClient
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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