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.

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})
Creates a OfflineSyncDatabaseContext for the configured synchronized tables.

Properties

foreignKeys → CrdtForeignKeyGraph
Foreign key relationships derived from the schema.
latefinal
hashCode int
The hash code for this object.
no setterinherited
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
toString() String
A string representation of this object.
inherited

Operators

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