Skip to main content

SyncularCore

Struct SyncularCore 

Source
pub struct SyncularCore {
    pub progress_listener: Option<SyncProgressListener>,
    /* private fields */
}
Expand description

The Tauri-free core: one client, its owned transport, explicit scheduling state, and the pending exact-event queue. Lives on ONE owning thread.

Fields§

§progress_listener: Option<SyncProgressListener>

Implementations§

Source§

impl SyncularCore

Source

pub fn new(config: &Value) -> Result<Self, String>

Build a core from the plugin config JSON (baseUrl, headers, …). A baseUrl under the native-transport feature owns a real HTTP+WS transport; without it the core is client-local only (tests, offline).

Source

pub fn new_with_notify( config: &Value, notify: Option<Arc<dyn Fn() + Send + Sync>>, ) -> Result<Self, String>

Source

pub fn command(&mut self, command: &Value) -> Value

Run one JSON command ({"method","params"}) through the shared router, then drain inbound realtime traffic and exact core events. Returns the driver-protocol {"result"|"error"} reply.

Source

pub fn query(&mut self, sql: &str, params: Value) -> Value

The syncular_query fast path: arbitrary read-only SQL over the local database. Routed through the same query command so there is one implementation (the router owns it); this wrapper spares the JS bridge from wrapping the method/params envelope for the hot live-query path.

Source

pub fn take_sync_intent(&mut self) -> SyncIntent

Consume the next coalesced host schedule. Interactive work preempts a pending retry; background work keeps the earliest real deadline.

Source

pub fn transport_enabled(&self) -> bool

Source

pub fn sync_until_idle(&mut self) -> Value

Run one syncUntilIdle round for the background host loop, deriving events afterwards. A no-op (empty reply) before create.

Source

pub fn prepare_round( &mut self, ) -> Result<(PreparedSyncRound, HostTransport), Box<SyncOutcome>>

Prepare on the owner; the returned transport view belongs to the I/O executor. Local commands continue using the owned client connection.

Source

pub fn apply_round(&mut self, completed: CompletedSyncRound) -> AppliedSyncRound

Source

pub fn set_transport_policy( &mut self, policy: HostTransportPolicy, ) -> Result<(), String>

Replace the native transport’s bounds for subsequent network calls (per-round deadlines, request/response byte limits, redirect policy). JSON config reaches the same policy through new; this is the programmatic seam for a host that builds its configuration in Rust. A round past its first exchange keeps its anchored deadline; every other bound takes effect on the next call. An invalid policy is rejected and the current policy stays in force.

Source

pub fn take_controls(&mut self) -> Option<(Vec<String>, HostTransport)>

Source

pub fn record_query_read( &mut self, id: &str, tables: &[String], failure: Option<&QueryReadFailure>, )

§7.6: record an owned snapshot read the read sidecar ran.

Source

pub fn poll_transport(&mut self)

Owner-mailbox wake from the native realtime reader.

Source

pub fn drain_events(&mut self) -> Vec<Event>

Drain every event queued since the last call (the host thread pushes them onto the Tauri channel). Mirrors the FFI poll_event, batched.

Source

pub fn set_headers(&mut self, headers: Vec<(String, String)>)

Replace the transport’s request headers. Rotating auth without tearing the plugin down). See HostTransport::set_headers for the HTTP/WS pickup semantics.

Source

pub fn shutdown(&mut self)

Release the socket/reader thread. Idempotent.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.