Skip to main content

Crate oxide_mirror

Crate oxide_mirror 

Source
Expand description

§oxide-mirror — Local, Event-Sourced Data Mirror

oxide-mirror keeps a SQLite-backed local copy of remote API data so AI agents can run complex SQL queries (joins, aggregations, time-window filters) across many services without paying the latency or rate-limit cost of going over the wire every time.

The crate is organised around four cooperating pieces:

  • event — the durable, append-only Delta log shape that every sync source emits. Each delta carries an explicit Provenance (source id + confidence) so callers can reason about who wrote what.
  • source — the SyncSource trait that oxide-gen generated clients implement. A source knows how to pull a batch of deltas starting from a cursor and to advance the cursor when the batch has been applied.
  • storeMirrorStore owns the SQLite pool, the schema migrations, the event log, the materialised MirroredRecord table, and the per-source cursor table. Exposes MirrorStore::query for read-only SQL.
  • syncSyncer ties the previous two together, pulling deltas from a SyncSource, applying them through a ConflictStrategy, and persisting the new cursor.

kernel::MirrorModule wires everything into the oxide-k kernel so sync runs and queries can be triggered via the kernel message bus.

Re-exports§

pub use conflict::ConflictResolution;
pub use conflict::ConflictStrategy;
pub use conflict::HighestConfidence;
pub use conflict::KeepLocal;
pub use conflict::LastWriteWins;
pub use conflict::MergeJson;
pub use error::MirrorError;
pub use error::Result;
pub use event::Delta;
pub use event::DeltaOp;
pub use event::MirroredRecord;
pub use event::Provenance;
pub use kernel::MirrorModule;
pub use source::PullResult;
pub use source::StaticSource;
pub use source::SyncSource;
pub use store::MirrorStore;
pub use sync::SyncReport;
pub use sync::Syncer;

Modules§

conflict
Conflict resolution strategies for incoming deltas.
error
Error type for oxide-mirror.
event
Delta + record shapes shared across the mirror.
kernel
oxide-k bus integration.
source
The SyncSource trait + reusable test helpers.
store
SQLite-backed MirrorStore.
sync
Glue layer that drives a SyncSource against a MirrorStore.