pub struct SyncCheckpoint { /* private fields */ }Expand description
Manages sync session checkpointing for crash recovery.
Tracks which entries have been processed, failed, or skipped during a sync session so that interrupted syncs can resume without re-downloading already-transferred blobs.
Implementations§
Source§impl SyncCheckpoint
impl SyncCheckpoint
Sourcepub fn new(database: &NodeDatabase, namespace_id: NamespaceId) -> Self
pub fn new(database: &NodeDatabase, namespace_id: NamespaceId) -> Self
Create a new checkpoint manager for the given namespace.
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
The current session ID.
Sourcepub const fn namespace_id(&self) -> NamespaceId
pub const fn namespace_id(&self) -> NamespaceId
The namespace ID for this checkpoint.
Sourcepub fn create_session(
database: &NodeDatabase,
namespace_id: NamespaceId,
) -> Result<Self>
pub fn create_session( database: &NodeDatabase, namespace_id: NamespaceId, ) -> Result<Self>
Create a new sync session in the database and return the checkpoint.
§Errors
Returns an error if the database write fails.
Sourcepub fn mark_completed(
&self,
entry_key: &[u8],
hash: Hash,
size: u64,
) -> Result<()>
pub fn mark_completed( &self, entry_key: &[u8], hash: Hash, size: u64, ) -> Result<()>
Mark an entry as completed (downloaded successfully).
§Errors
Returns an error if the database write fails.
Sourcepub fn mark_skipped(
&self,
entry_key: &[u8],
hash: Hash,
size: u64,
) -> Result<()>
pub fn mark_skipped( &self, entry_key: &[u8], hash: Hash, size: u64, ) -> Result<()>
Mark an entry as skipped (already present locally or deleted).
§Errors
Returns an error if the database write fails.
Sourcepub fn completed_entries(&self) -> Result<Vec<EntryProgress>>
pub fn completed_entries(&self) -> Result<Vec<EntryProgress>>
Get all completed entries for this session (for resume filtering).
§Errors
Returns an error if the database query fails.
Sourcepub fn failed_entries(&self) -> Result<Vec<EntryProgress>>
pub fn failed_entries(&self) -> Result<Vec<EntryProgress>>
Get all failed entries for this session (for retry).
§Errors
Returns an error if the database query fails.
Sourcepub fn completed_keys(&self) -> Result<HashSet<Vec<u8>>>
pub fn completed_keys(&self) -> Result<HashSet<Vec<u8>>>
Get all completed entry keys as a HashSet for fast lookup.
§Errors
Returns an error if the database query fails.
Sourcepub fn progress(&self) -> Result<CheckpointProgress>
pub fn progress(&self) -> Result<CheckpointProgress>
Sourcepub const fn leave_unfinished(&self) -> Result<()>
pub const fn leave_unfinished(&self) -> Result<()>
Sourcepub fn resume(
database: &NodeDatabase,
namespace_id: NamespaceId,
) -> Result<Option<Self>>
pub fn resume( database: &NodeDatabase, namespace_id: NamespaceId, ) -> Result<Option<Self>>
Load the most recent unfinished checkpoint for a folder.
Returns None if no unfinished checkpoint exists.
§Errors
Returns an error if the database query fails.
Trait Implementations§
Source§impl Clone for SyncCheckpoint
impl Clone for SyncCheckpoint
Source§fn clone(&self) -> SyncCheckpoint
fn clone(&self) -> SyncCheckpoint
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 Freeze for SyncCheckpoint
impl RefUnwindSafe for SyncCheckpoint
impl Send for SyncCheckpoint
impl Sync for SyncCheckpoint
impl Unpin for SyncCheckpoint
impl UnsafeUnpin for SyncCheckpoint
impl UnwindSafe for SyncCheckpoint
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