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
impl SyncularCore
Sourcepub fn new(config: &Value) -> Result<Self, String>
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).
pub fn new_with_notify( config: &Value, notify: Option<Arc<dyn Fn() + Send + Sync>>, ) -> Result<Self, String>
Sourcepub fn command(&mut self, command: &Value) -> Value
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.
Sourcepub fn query(&mut self, sql: &str, params: Value) -> Value
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.
Sourcepub fn take_sync_intent(&mut self) -> SyncIntent
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.
Sourcepub fn sync_until_idle(&mut self) -> Value
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.
Sourcepub fn poll_transport(&mut self)
pub fn poll_transport(&mut self)
Owner-mailbox wake from the native realtime reader.
Sourcepub fn drain_events(&mut self) -> Vec<Event>
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.
Sourcepub fn set_headers(&mut self, headers: Vec<(String, String)>)
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.