maybeGarbageCollect method

Future<void> maybeGarbageCollect(
  1. String origin,
  2. DateTime commitTimestamp
)

Implementation

Future<void> maybeGarbageCollect(
  String origin,
  DateTime commitTimestamp,
) async {
  if (origin == authState!.clientId) {
    /* Any outstanding transaction that originated on Satellite but haven't
     * been received back from the Electric is considered to be concurrent with
     * any other transaction coming from Electric.
     *
     * Thus we need to keep oplog entries in order to be able to do conflict
     * resolution with add-wins semantics.
     *
     * Once we receive transaction that was originated on the Satellite, oplog
     * entries that correspond to such transaction can be safely removed as
     * they are no longer necessary for conflict resolution.
     */
    await garbageCollectOplog(commitTimestamp);
  }
}