OfflineSyncDatabaseContext class
Process-level CRDT database metadata shared by ephemeral database wrappers.
A single context is created per OfflineSyncEngine (i.e. once per Serverpod
instance) and shared by every ephemeral OfflineSyncDatabase, so the schema is
synchronized once per process rather than once per Session.
Projection rebuilds required by registry changes are also shared; a failed
rebuild is retried by a later initialization.
The cached schema holds database-assigned identifiers and is never invalidated for the lifetime of the context. This assumes the CRDT schema rows stay stable while the process is alive, which holds for a normal server whose database is not reset underneath it. If the schema rows are dropped and re-created with different identifiers while the process lives, a new context must be created.
Constructors
-
OfflineSyncDatabaseContext({required List<
Table> syncTables, required DatabaseSerializationManager serializationManager, int? maxConcurrentMerges, void onCommittedSpaces(Map<UuidValue, int> revisions)?, bool filterMetadataChanges = true}) - Creates a OfflineSyncDatabaseContext for the configured synchronized tables.
Properties
- filterMetadataChanges → bool
-
Whether watches may skip metadata events using this context's write cache.
final
- foreignKeys → CrdtForeignKeyGraph
-
Foreign key relationships derived from the schema.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onCommittedSpaces
→ void Function(Map<
UuidValue, int> revisions)? -
Optional best-effort publication of space revisions after an owned
transaction commits. The callback must enqueue work without waiting for
network delivery. Publication failure never changes the commit outcome.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
syncTables
→ List<
Table> -
The list of tables to sync with CRDT.
final
Methods
-
initialize(
DatabaseSession session) → Future< void> - Initializes shared schema rows and caches their generated identifiers.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
receiveCommittedSpaces(
Map< UuidValue, int> changed) → void - Wakes interested streams after a committed revision is observed locally or received through a hint transport. Hints never grant access or advance checkpoints. Every sender rechecks membership and captures durable data; recovery continues to compare database revisions after missed hints.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited