EventNotifier class

Implemented types

Constructors

EventNotifier({required DbName dbName, EventEmitter? eventEmitter})

Properties

attachedDbIndex AttachedDbIndex
Technically, we keep track of the attached dbs in two mappings -- one is alias: name, the other name: alias.
latefinaloverride-getter
dbName DbName
The name of the primary database that components communicating via this notifier have open and are using.
final
events EventEmitter
latefinal
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

actuallyChanged(DbName dbName, List<Change> changes, ChangeOrigin origin) → void
When Satellite detects actual data changes in the oplog for a given database, it replicates it and calls actuallyChanged with the list of changes.
override
alias(ChangeNotification notification) List<QualifiedTablename>
And we provide a helper method to alias changes in the form {attachedDbName, tablenames} to aliasedTablenames.
override
attach(DbName dbName, String dbAlias) → void
Some drivers can attach other open databases and reference them by alias (i.e.: first you attach('foo.db') then you can write SQL queries like select * from foo.bars. We keep track of attached databases and their aliases, so we can map the table namespaces in SQL queries to their real database names and thus emit and handle notifications to and from them.
override
authStateChanged(AuthState authState) → void
Calling authStateChanged notifies the Satellite process that the user's authentication credentials have changed.
override
connectivityStateChanged(String dbName, ConnectivityState status) → void
Notification for network connectivity state changes. A connectivity change is automatically triggered in consequence of internal client events. 'connected': connection to Electric established 'disconnected': Electric is unreachable, or network is unavailable. A reason for the disconnection can be provided.
override
detach(String dbAlias) → void
override
emit(String eventName, Notification notification) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
potentiallyChanged() → void
The data change notification workflow starts by the electric database clients (or the user manually) calling potentiallyChanged whenever a write or transaction has been issued that may have changed the contents of either the primary or any of the attached databases.
override
shapeSubscriptionSyncStatusChanged(String dbName, String key, SyncStatus status) → void
Notification for shape subscription sync status changes. Every notification will include a key that uniquely identifies the shape for which the sync status changed, as well as the new sync status.
override
subscribeToAuthStateChanges(AuthStateCallback callback) → UnsubscribeFunction
override
subscribeToConnectivityStateChanges(ConnectivityStateChangeCallback callback) → UnsubscribeFunction
override
subscribeToDataChanges(ChangeCallback callback) → UnsubscribeFunction
Reactive hooks then subscribe to "data has actually changed" notifications, using the info to trigger re-queries, if the changes affect databases and tables that their queries depend on. This then trigger re-rendering iff the query results are actually affected by the data changes.
override
subscribeToPotentialDataChanges(PotentialChangeCallback callback) → UnsubscribeFunction
Satellite processes subscribe to these "data has potentially changed" notifications. When they get one, they check the _oplog table in the database for actual changes persisted by the triggers.
override
subscribeToShapeSubscriptionSyncStatusChanges(ShapeSubscriptionSyncStatusChangeCallback callback) → UnsubscribeFunction
override
toString() String
A string representation of this object.
inherited

Operators

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