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
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.
pub fn transport_enabled(&self) -> bool
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 prepare_round(
&mut self,
) -> Result<(PreparedSyncRound, HostTransport), Box<SyncOutcome>>
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.
pub fn apply_round(&mut self, completed: CompletedSyncRound) -> AppliedSyncRound
Sourcepub fn set_transport_policy(
&mut self,
policy: HostTransportPolicy,
) -> Result<(), String>
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.
pub fn take_controls(&mut self) -> Option<(Vec<String>, HostTransport)>
Sourcepub fn record_query_read(
&mut self,
id: &str,
tables: &[String],
failure: Option<&QueryReadFailure>,
)
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.
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. Rotating
auth without tearing the plugin down). See
HostTransport::set_headers for the HTTP/WS pickup semantics.