Skip to main content

Crate rightkit_sync

Crate rightkit_sync 

Source
Expand description

Brand-neutral cloud sync engine. See API.md for the adapter traits and the record/conflict contract shared with the iOS CloudKit implementation.

Modules§

field
helper
Backend for a helper process speaking the rightkit-sync-helper/1 line-JSON protocol. The macOS CloudKit helper (rightkit-cloudkit-helper, Swift) is the production implementation; rightkit-sync-fake-helper is the protocol fake used by the end-to-end tests. See API.md section 4.
wire
Line-JSON wire format of the rightkit-sync-helper/1 protocol. One JSON object per line, UTF-8, no other framing. See API.md section 4.

Structs§

AlwaysAvailable
BackoffPolicy
Deterministic exponential backoff merged with server hints.
ChangePage
ConsentRequest
A change of the signed-in account or sync scope that the app has not yet consented to. from is the scope the local store last synced with; to is the scope now signed in.
FileStorage
Atomic, durable, owner-only write (temp file, fsync, rename, fsync directory) to one file, through rightkit_fs::atomic_write_private.
ItemHeader
Immutable identity + version of one syncable item.
LastWriterWins
Ledger
LedgerStore
MemoryBackend
MemoryStorage
Clonable in-memory storage; clones share bytes (simulates an app restart).
NoHooks
NullObserver
PassReport
RawRecord
RecordOutcome
RemoteVersion
SchedulePolicy
Delays the scheduler suggests. backoff should match the engine’s SyncConfig::backoff.
SyncBudget
What one sync_once call may spend.
SyncConfig
SyncEngine
SyncEngineBuilder
SyncMetrics
Cumulative engine counters and current ledger queue sizes, from SyncEngine::metrics. Queue sizes are the figures that grow resident memory: the ledger keeps one remote version per record and is serialized in full on every durable write.
SyncReport
What sync_once did, in plain data a host can pass across an FFI boundary.
SyncStatus
Runtime figures of the engine, computed on call by SyncEngine::status.
SystemClock

Enums§

ApplyOutcome
Result of landing one downloaded item locally.
ConsentChoice
The app’s answer to a PassOutcome::ConsentRequired pause.
FieldValue
PassOutcome
SavePolicy
SyncError
WorkOutcome
How the host should report the run to its scheduler.

Traits§

AuthProvider
Account state and session credentials. generation changes on account switch; an in-flight pass observing a different generation cancels itself.
Backend
The cloud zone. Method set mirrors the iOS CloudSyncService.
Clock
ConflictPolicy
Last-writer-wins by default. Tombstones and duplicate-alias reduction are fixed by the shared contract and not pluggable here.
LedgerStorage
LocalStore
The app’s local data. All calls are synchronous.
PassHooks
Optional domain extension for record types the engine does not own (device announcements, request queues, …).
RecordMapper
Domain <-> wire mapping for the one syncable item type.
SyncObserver
Free-form diagnostics hook (no logging dependency baked in).

Functions§

next_delay
Seconds until the next run, never below policy.min_secs; None when nothing should be scheduled (disabled, or waiting for the app’s consent answer).
read_tombstone
(id, deletedAt) when the record is a tombstone. The id falls back to the record name for legacy tombstones that lost their id field.
should_continue
Whether another pass should run inside the same call.
sync_once
Runs the engine for one bounded unit of work. Never sleeps; see the module docs.
work_outcome
How the host reports outcome to its scheduler.
write_tombstone
Tombstone convention shared with HeardRight iOS: keep id, updatedAt (= deletion time) and deletedAt; clear every other field except keep. Decoders must not require any other field on a tombstone.

Type Aliases§

Extras
Durable app-owned scratch the engine persists inside its ledger.
SyncResult