Skip to main content

SyncularCore

Struct SyncularCore 

Source
pub struct SyncularCore { /* 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.

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 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 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 (RFC 0002 §2.3 — 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.