pub struct SyncClient { /* private fields */ }Implementations§
Source§impl SyncClient
impl SyncClient
pub fn new(db: Arc<Database>, nats_url: &str, tenant_id: &str) -> Self
Sourcepub async fn ensure_connected(&self) -> Result<Client, String>
pub async fn ensure_connected(&self) -> Result<Client, String>
Lazily connect to NATS, reuse existing connection. Returns cloned Client (cheap — Arc internally) so the mutex is not held during NATS ops. Returns Err with connection error message if NATS is unreachable.
pub async fn is_connected(&self) -> bool
pub fn db(&self) -> &Database
pub fn has_pending_push_changes(&self) -> Result<bool, Error>
pub async fn push(&self) -> Result<ApplyResult, Error>
Sourcepub async fn pull(
&self,
policies: &ConflictPolicies,
) -> Result<ApplyResult, Error>
pub async fn pull( &self, policies: &ConflictPolicies, ) -> Result<ApplyResult, Error>
Pull with explicit policies (frozen test contract, library consumers).
Sourcepub async fn pull_default(&self) -> Result<ApplyResult, Error>
pub async fn pull_default(&self) -> Result<ApplyResult, Error>
Pull using internally configured conflict policies (used by CLI).
Sourcepub async fn initial_sync(
&self,
policies: &ConflictPolicies,
) -> Result<ApplyResult, Error>
pub async fn initial_sync( &self, policies: &ConflictPolicies, ) -> Result<ApplyResult, Error>
Initial sync using explicit policies (frozen test contract).
pub fn push_watermark(&self) -> u64
pub fn pull_watermark(&self) -> u64
pub fn tenant_id(&self) -> &str
pub fn nats_url(&self) -> &str
pub fn set_table_direction(&self, table: &str, direction: SyncDirection)
pub fn set_conflict_policy(&self, table: &str, policy: ConflictPolicy)
pub fn set_default_conflict_policy(&self, policy: ConflictPolicy)
Auto Trait Implementations§
impl !Freeze for SyncClient
impl !RefUnwindSafe for SyncClient
impl Send for SyncClient
impl Sync for SyncClient
impl Unpin for SyncClient
impl UnsafeUnpin for SyncClient
impl !UnwindSafe for SyncClient
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
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>
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 more