SyncSource class abstract interface

Owns entities: their records come from the source, never from a REST response, a stream frame or a snapshot, and their mutations go to the source.

The cache runs one principal's sources at a time. Between principals it stops them, closes the old session and drops every owned record before the next principal's sources start.

A source writes records only through SyncContext.write, and only while its context is SyncContext.active. The cache deactivates the context synchronously, inside the setPrincipal call that moves to the next principal and before that call empties the store, and on dispose. From then on a write is dropped, even while stop is still running: the store already belongs to the next principal. A source must never write through context.cache.store directly. The cache also drops every owned record once the old sources stopped, but that only catches what a source wrote outside the seam; by then the next principal may have read it.

Properties

entities → Set<String>
The typenames this source owns.
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

apply(PendingMutation mutation) → Future<MutationOutcome>
Apply one mutation locally; it may complete offline.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
start(SyncContext context) → Future<void>
Begin syncing for context.principal.
status(String entity) → Stream<SyncStatus>
The status of one owned entity type. Emits the current status to each new listener first, then every change.
stop() → Future<void>
Stop syncing. Idempotent: the cache may call it on a source whose start threw. The cache closes the session after every source stopped.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited