notifyUpdates method
Dispatches the set of updates
to the stream query manager.
This method is more specific than markTablesUpdated
in the presence of
triggers or foreign key constraints. Drift needs to support both when
calculating which streams to update. For instance, consider a simple
database with two tables (a
and b
) and a trigger inserting into b
after a delete on a
).
Now, an insert on a
should not update a stream listening on table b
,
but a delete should! This additional information is not available with
markTablesUpdated
, so notifyUpdates
can be used to more efficiently
calculate stream updates in some instances.
Implementation
void notifyUpdates(Set<TableUpdate> updates) {
final withRulesApplied = attachedDatabase.streamUpdateRules.apply(updates);
resolvedEngine.streamQueries.handleTableUpdates(withRulesApplied);
}