purgeOutstandingWrites method

Future<void> purgeOutstandingWrites()

Cancels every write the server has not acknowledged, and every running transaction.

Local events revert the writes, and their Futures and the transactions fail with write-canceled. A write that was already sent can still be applied by the server: its acknowledgement is ignored here. onDisconnect operations still queued locally are cancelled and their Futures fail with write-canceled; those the server has already registered are not undone. The returned Future completes at once, after the local revert and with no round trip; after close it fails with database-closed.

Implementation

Future<void> purgeOutstandingWrites() =>
    _request<void>((Repo repo, _Pending<void> pending) {
      repo.purgeOutstandingWrites();
      pending.complete(null);
    });