Data model & realtime

Bidirectional sync with declared conflict policies

Would let two writable systems exchange changes with an explicit, per-collection rule for what happens when both changed the same record.

RoadmapEngine edition 5f8ea3af

What it does

The sync crate defines a versioned mutation model, a hybrid logical clock, per-collection conflict policies and an anti-entropy batch format, and proves convergence in a seeded simulator. No route or command uses it, so no user can run a sync today.

How it works

Mutations carry a site id, a hybrid logical clock timestamp, a per-site sequence number and a causal context. A replica applies them idempotently and resolves conflicts under the policy declared for the collection: last-writer-wins with a deterministic site tiebreak, field-level merge, a multi-value register that keeps concurrent siblings, a positive-negative counter, an observed-remove set, reject-and-queue for manual review, or a preferred site. A separate setting declares whether a concurrent delete or update wins.

The convergence simulator is seeded and reproducible. It runs at least three replicas with clock skew and injected drops, duplicates and reordering, and checks that replicas converge under each policy. An engine adapter maps entities to the sync model through public engine calls, and tests cover convergence between a disk-profile and a memory-profile engine, recovery after the log has been trimmed, and fail-closed handling of corrupt durable records.

Where you reach it

  • Librarykynetra_sync: Replica, ConflictPolicy, DeleteSemantics, Batch, SyncEngineAdapter (engine library, not wired to the server)

Limits

  • Not reachable from the server or the command line, and no transport exists for exchanging batches.
  • Convergence is shown in a simulator and in two-engine tests, not over a network.

Evidence

  • TestsCovered in the engine repository by more than 100 tests: convergence per policy, delete semantics, engine adapter and trim recovery

Test coverage is listed as present in the engine repository at this edition. This page does not report test results.

KynetraDB is in private preview

This is not available in the preview. Request a preview to discuss the current scope.