serverpod_offline_sync library

Classes

BaseHlc
Base class for HLC timestamps.
CrdtDataAttemptedValue
Authored field value retained while the domain column holds a projection.
CrdtDataAttemptedValueAttachRowRepository
CrdtDataAttemptedValueInclude
CrdtDataAttemptedValueIncludeList
CrdtDataAttemptedValueRepository
CrdtDataAttemptedValueTable
CrdtDataAttemptedValueUpdateTable
CrdtDataDeleted
CRDT visibility generation table.
CrdtDataDeletedAttachRowRepository
CrdtDataDeletedDetachRowRepository
CrdtDataDeletedInclude
CrdtDataDeletedIncludeList
CrdtDataDeletedRepository
CrdtDataDeletedTable
CrdtDataDeletedUpdateTable
CrdtDataField
CRDT data table.
CrdtDataFieldAttachRowRepository
CrdtDataFieldDetachRowRepository
CrdtDataFieldInclude
CrdtDataFieldIncludeList
CrdtDataFieldRepository
CrdtDataFieldTable
CrdtDataFieldUpdateTable
CrdtDataRow
CRDT data rows table.
CrdtDataRowAttachRepository
CrdtDataRowAttachRowRepository
CrdtDataRowDetachRowRepository
CrdtDataRowInclude
CrdtDataRowIncludeList
CrdtDataRowRepository
CrdtDataRowTable
CrdtDataRowUpdateTable
CrdtMergeChange
A remote CRDT change to merge.
CrdtMergeDelete
A remote visibility CLFlag update to merge.
CrdtMergeInsert
A remote row insertion to merge.
CrdtMergeUpdate
A remote field update to merge.
CrdtMutationRecorder
Persists additional CRDT rows after a mutating ORM operation completes.
CrdtNode
CRDT nodes table.
CrdtNodeInclude
CrdtNodeIncludeList
CrdtNodeRepository
CrdtNodeTable
CrdtNodeUpdateTable
CrdtSchemaColumn
CRDT schema columns table.
CrdtSchemaColumnAttachRowRepository
CrdtSchemaColumnInclude
CrdtSchemaColumnIncludeList
CrdtSchemaColumnRepository
CrdtSchemaColumnTable
CrdtSchemaColumnUpdateTable
CrdtSchemaRegistry
Manages the CRDT schema for a database.
CrdtSchemaTable
CRDT schema tables table.
CrdtSchemaTableInclude
CrdtSchemaTableIncludeList
CrdtSchemaTableRepository
CrdtSchemaTableTable
CrdtSchemaTableUpdateTable
Hlc
A Hybrid Logical Clock implementation that supports both ISO 8601 and Unix timestamp formats. The datetime component has millisecond precision and is always stored in UTC.
HlcManager
A manager for Hlc instances that is used to generate unique timestamps for CRDT operations.
OfflineSyncCancellation
Cancellation for one sync session, bound only while its merge is active.
OfflineSyncClient
High-level client sync helpers built on top of a CRDT stream transport.
OfflineSyncClose
Requests cancellation of a continuous stream, discarding partial input.
OfflineSyncCommitted
Confirms that every accepted space in the batch committed durably.
OfflineSyncConnect
Session identity and initial grants sent together before any space work.
OfflineSyncDatabase
Database proxy that runs insert/update/delete ORM operations inside a transaction to record each change in the CRDT tables.
OfflineSyncDatabaseContext
Process-level CRDT database metadata shared by ephemeral database wrappers.
OfflineSyncDatabaseSession
Wraps a DatabaseSession to provide a OfflineSyncDatabase as DatabaseSession.db.
OfflineSyncEndOfBatch
Completes a numbered batch, allowing its receiver to apply it.
OfflineSyncEngine
The shared CRDT synchronization logic used by both client and server nodes.
OfflineSyncIntegrityViolation
Durable record of a terminal CRDT sync integrity violation.
OfflineSyncIntegrityViolationInclude
OfflineSyncIntegrityViolationIncludeList
OfflineSyncIntegrityViolationRepository
OfflineSyncIntegrityViolationTable
OfflineSyncIntegrityViolationUpdateTable
OfflineSyncMergeChunk
Changes belonging to one numbered batch. Chunks do not imply commit.
OfflineSyncNodeCheckpoint
A committed prefix of a replica's local delivery order.
OfflineSyncPeer
A replica epoch scoped to the authenticated user of its connection.
OfflineSyncPeerCheckpoint
A committed prefix of one immediate peer's local delivery revision.
OfflineSyncPeerCheckpointAttachRowRepository
OfflineSyncPeerCheckpointInclude
OfflineSyncPeerCheckpointIncludeList
OfflineSyncPeerCheckpointRepository
OfflineSyncPeerCheckpointTable
OfflineSyncPeerCheckpointUpdateTable
OfflineSyncPeerInclude
OfflineSyncPeerIncludeList
OfflineSyncPeerRepository
OfflineSyncPeerTable
OfflineSyncPeerUpdateTable
OfflineSyncReady
Completes initial grant and resume-vector announcements.
OfflineSyncSinceRevision
Per-space durable resume positions, scoped to the authenticated user's peers.
OfflineSyncSpace
CRDT spaces table.
OfflineSyncSpaceAttachRepository
OfflineSyncSpaceAttachRowRepository
OfflineSyncSpaceCheckpoint
Complete capture bound in the sending replica's local delivery order.
OfflineSyncSpaceGrant
A single space a peer announces in a OfflineSyncSpaceSet.
OfflineSyncSpaceInclude
OfflineSyncSpaceIncludeList
OfflineSyncSpaceManager
A manager for OfflineSyncSpace rows and the local user clocks acting in them.
OfflineSyncSpaceMember
Authorization membership for shared CRDT spaces.
OfflineSyncSpaceMemberAttachRowRepository
OfflineSyncSpaceMemberInclude
OfflineSyncSpaceMemberIncludeList
OfflineSyncSpaceMemberRepository
OfflineSyncSpaceMembership
Resolves shared-space membership from the offline_sync_space_members table.
OfflineSyncSpaceMemberTable
OfflineSyncSpaceMemberUpdateTable
OfflineSyncSpaceNode
A CRDT node's participation and observed clock within one space.
OfflineSyncSpaceNodeAttachRowRepository
OfflineSyncSpaceNodeInclude
OfflineSyncSpaceNodeIncludeList
OfflineSyncSpaceNodeRepository
OfflineSyncSpaceNodeTable
OfflineSyncSpaceNodeUpdateTable
OfflineSyncSpaceRepository
OfflineSyncSpaceSet
Authoritative or informational space set exchanged at the start of a cycle.
OfflineSyncSpacesTransaction
Space scopes sharing one transaction for one authenticated user.
OfflineSyncSpaceTable
OfflineSyncSpaceUpdateTable
OfflineSyncStreamEvent
A CRDT sync event sent over a bidirectional stream.
OfflineSyncSubscription
A running continuous CRDT sync session.
Protocol

Enums

CrdtDataDeletedReason
Why a synced user tombstone changed row visibility.
CrdtDataRowVisibility
Materialized visibility state for a CRDT row.
CrdtProjectionReason
Why a domain column currently differs from its authored value.
OfflineSyncPeerMode
How a peer decides which spaces it syncs.
OfflineSyncSpaceRole
CRDT access role for a member of a shared space.
OfflineSyncViolationOperation
Merge or sync operation that observed an integrity violation.
OfflineSyncViolationType
High-level category of a durable CRDT sync integrity violation.

Extensions

BaseHlcToHlc on BaseHlc
Extensions for BaseHlc to convert it to an Hlc.
CrdtDataDeletedExtension on CrdtDataDeleted
Extensions for the CrdtDataDeleted class.
CrdtDataDeletedReasonExtension on CrdtDataDeletedReason
Extensions for the CrdtDataDeletedReason enum.
CrdtDataFieldExtension on CrdtDataField
Extensions for the CrdtDataField class.
CrdtDataRowExtension on CrdtDataRow
Extensions for the CrdtDataRow class.
CrdtDataRowVisibilityExtension on CrdtDataRowVisibility
Extensions for the CrdtDataRowVisibility enum.
CrdtMergeChangeExtension on CrdtMergeChange
Convenience helpers shared by every merge change.
CrdtMergeChangeStreamExtension on Stream<CrdtMergeChange>
Helpers for grouping merge changes into stream payload batches.
CrdtMergeInsertExtension on CrdtMergeInsert
Convenience helpers for insert changes.
CrdtMergeRecorderExtension on CrdtMutationRecorder
Adds merge-specific behavior to CrdtMutationRecorder.
CrdtMergeSetExtension on CrdtMergeSet
CRDT merge helpers for CrdtMergeSet.
HlcMax on Iterable<Hlc>
Extensions for an Iterable of Hlc.
IncludeTombstonedRows on Table
Extension on Table that exposes includeHiddenRows for use in where clauses to bypass the CRDT tombstone/visibility filter.
OfflineSyncDatabaseAccess on DatabaseSession
Convenience access to a CRDT-aware database from a wrapped session.
OfflineSyncRevisionCapture on OfflineSyncEngine
Durable replica-local checkpoint capture and receiver receipts.
OfflineSyncSpaceRoleWriteAccess on OfflineSyncSpaceRole?
CRDT write capability for a space role.
SpaceUuidFilter on Table
Extension on Table that exposes spaceEquals for use in where clauses to restrict membership-wide reads to a single space.

Properties

crdtRowLastVisibleVisibilityIndex → int
Last serialized index that still represents a visible CRDT row.
final

Typedefs

CrdtMergeMetadataLookup = ({Map<String, Set<String>> columnNamesByTable, Map<String, Set<UuidValue>> rowIdsByTable})
Merge metadata extracted from a CrdtMergeSet.
CrdtMergeSet = List<CrdtMergeChange>
A group of CRDT merge changes collected for one sync batch.
DomainRowOwner = ({bool exists, int? spaceId})
A tuple representing the ownership of a domain row.
DomainRowOwnerCache = Map<(String, UuidValue), DomainRowOwner>
A cache of domain row owners by table name and row id.
OfflineSyncCapture = ({List<CrdtMergeChange> changes, List<OfflineSyncSpaceCheckpoint> checkpoints})
A complete range of this replica's committed state, detached from its snapshot.
OfflineSyncOnMergeSuccess = FutureOr<void> Function(UuidValue spaceUuid, Hlc syncedHlc, Set<String> affectedTables)
Called after a successful per-space merge/checkpoint exchange.
OfflineSyncTransport = Stream<OfflineSyncStreamEvent> Function({required Stream<OfflineSyncStreamEvent> changes, required bool once})
Opens the remote half of a CRDT sync stream.

Exceptions / Errors

ClockDriftException
Exception thrown when the clock drift exceeds the maximum allowed.
DuplicateNodeException
Exception thrown when a duplicate node is detected.
OfflineSyncCancelledException
Thrown when cancellation stops a merge before it commits.
OfflineSyncException
Base type for CRDT sync session failures.
OfflineSyncIntegrityViolationException
Thrown when sync observes terminal CRDT metadata/domain-row inconsistency.
OfflineSyncReservedValueException
A caller tried to author a unique value reserved for sync projection.
OfflineSyncSchemaReconciliationException
Thrown when CRDT schema reconciliation cannot be applied safely.
OfflineSyncSpaceMembershipException
Thrown when a user attempts to act in a space they are not a member of.
OfflineSyncSpaceRoleException
Thrown when a user attempts to write in a space with a non-writable role.
OfflineSyncStreamClosedException
Thrown when the inbound sync stream closes before an expected event arrives.
OfflineSyncTablesHashMismatchException
Thrown when the sync tables hash sent by a peer does not match locally.
OfflineSyncUnexpectedEventException<T extends OfflineSyncStreamEvent>
Thrown when the inbound sync stream delivers an event of the wrong type.
OverflowException
Exception thrown when the timestamp counter overflows.