pub struct SyncLoopHandle { /* private fields */ }Expand description
Manages the background sync loop and provides access to sync components.
Implementations§
Source§impl SyncLoopHandle
impl SyncLoopHandle
pub fn new( components: SyncComponents, db: Arc<dyn SyncBookkeeping>, clock: ClockRef, library_dir: LibraryDir, blob_plan: Arc<dyn BlobPlan>, observer: Option<Arc<dyn BlobUploadObserver>>, ) -> Self
Sourcepub fn start(&self)
pub fn start(&self)
Start the background sync loop. No-op if already running.
Spawns a dedicated OS thread with its own tokio runtime because the sync session holds a raw sqlite3 pointer (not Send across tokio task boundaries).
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Whether the background sync thread is running.
Sourcepub fn trigger(&self)
pub fn trigger(&self)
Signal the sync loop to run a cycle immediately.
Full means a trigger is already pending — our request collapses
into the existing one, which is exactly what the capacity-1 channel
is for. Closed means the loop is gone, so the trigger is moot.
Sourcepub fn subscribe(&self) -> Receiver<SyncLoopStatus>
pub fn subscribe(&self) -> Receiver<SyncLoopStatus>
Subscribe to sync loop status events.
pub fn storage(&self) -> &Arc<EncryptedSyncStorage>
pub fn user_keypair(&self) -> &UserKeypair
pub fn hlc(&self) -> &Arc<Hlc>
pub fn encryption(&self) -> &Arc<RwLock<EncryptionService>>
Auto Trait Implementations§
impl !Freeze for SyncLoopHandle
impl !RefUnwindSafe for SyncLoopHandle
impl Send for SyncLoopHandle
impl Sync for SyncLoopHandle
impl Unpin for SyncLoopHandle
impl !UnwindSafe for SyncLoopHandle
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moreCreates a shared type from an unshared type.