pub struct SnapshotStore { /* private fields */ }Expand description
Persists snapshot manifests and pins all content referenced by them.
Implementations§
Source§impl SnapshotStore
impl SnapshotStore
pub const fn new(blobs: BlobStore) -> Self
pub const fn with_docs(blobs: BlobStore, docs: DocsEngine) -> Self
pub fn from_node(node: &IrohNode) -> Self
Sourcepub async fn create_snapshot(
&self,
namespace_id: Option<NamespaceId>,
entries: Vec<SnapshotEntry>,
description: Option<String>,
) -> Result<Snapshot>
pub async fn create_snapshot( &self, namespace_id: Option<NamespaceId>, entries: Vec<SnapshotEntry>, description: Option<String>, ) -> Result<Snapshot>
Create and persist a snapshot from existing content references.
§Errors
Returns an error if a referenced blob is unavailable or the manifest cannot be stored.
Sourcepub async fn create_from_path(
&self,
source_value: impl AsRef<Path>,
threads: usize,
description: Option<String>,
) -> Result<Snapshot>
pub async fn create_from_path( &self, source_value: impl AsRef<Path>, threads: usize, description: Option<String>, ) -> Result<Snapshot>
Create a snapshot from a local directory.
Files are imported into the content-addressed store once; the snapshot itself only stores references to those blobs.
§Errors
Returns an error if scanning, importing, or manifest storage fails.
Sourcepub async fn create_for_folder(
&self,
folder: &SyncwebFolder,
description: Option<String>,
) -> Result<Snapshot>
pub async fn create_for_folder( &self, folder: &SyncwebFolder, description: Option<String>, ) -> Result<Snapshot>
Create a snapshot of the latest entries in a synchronized folder.
§Errors
Returns an error if entries cannot be read or referenced blobs are missing.
Sourcepub async fn restore_to_path(
&self,
snapshot: &Snapshot,
destination_value: impl AsRef<Path>,
) -> Result<Vec<PathBuf>>
pub async fn restore_to_path( &self, snapshot: &Snapshot, destination_value: impl AsRef<Path>, ) -> Result<Vec<PathBuf>>
Restore a snapshot to a local directory, removing files not present in it.
§Errors
Returns an error if referenced content is unavailable or materialization fails.
Sourcepub async fn restore_for_folder(
&self,
folder: &SyncwebFolder,
snapshot: &Snapshot,
) -> Result<()>
pub async fn restore_for_folder( &self, folder: &SyncwebFolder, snapshot: &Snapshot, ) -> Result<()>
Restore a snapshot by updating a synchronized folder’s document entries.
§Errors
Returns an error if the snapshot belongs to another folder, content is missing, or document updates fail.
Sourcepub async fn list(&self) -> Result<Vec<Snapshot>>
pub async fn list(&self) -> Result<Vec<Snapshot>>
List all locally pinned snapshots.
§Errors
Returns an error if snapshot pins or manifests cannot be read.
Sourcepub async fn load(&self, id: SnapshotId) -> Result<Snapshot>
pub async fn load(&self, id: SnapshotId) -> Result<Snapshot>
Load a snapshot by its content-addressed identifier.
§Errors
Returns an error if the snapshot is not pinned or cannot be decoded.
Sourcepub async fn delete(&self, id: SnapshotId) -> Result<()>
pub async fn delete(&self, id: SnapshotId) -> Result<()>
Remove a snapshot and release its pins.
§Errors
Returns an error if the snapshot cannot be found or pins cannot be removed.
Sourcepub async fn ticket(
&self,
endpoint: &Endpoint,
snapshot: &Snapshot,
) -> Result<BlobTicket>
pub async fn ticket( &self, endpoint: &Endpoint, snapshot: &Snapshot, ) -> Result<BlobTicket>
Create a ticket for a snapshot manifest.
§Errors
Returns an error if the snapshot is not locally available.
Sourcepub async fn import_ticket(
&self,
endpoint: &Endpoint,
ticket: &BlobTicket,
) -> Result<Snapshot>
pub async fn import_ticket( &self, endpoint: &Endpoint, ticket: &BlobTicket, ) -> Result<Snapshot>
Fetch a shared snapshot manifest and all referenced content blobs.
§Errors
Returns an error if the ticket, manifest, or any content blob cannot be fetched.
Trait Implementations§
Source§impl Clone for SnapshotStore
impl Clone for SnapshotStore
Source§fn clone(&self) -> SnapshotStore
fn clone(&self) -> SnapshotStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SnapshotStore
impl !UnwindSafe for SnapshotStore
impl Freeze for SnapshotStore
impl Send for SnapshotStore
impl Sync for SnapshotStore
impl Unpin for SnapshotStore
impl UnsafeUnpin for SnapshotStore
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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