compact method
Permanently removes tombstoned records whose wall-clock time is older
than horizon and returns the number of reclaimed records.
Defaults to throwing UnsupportedError. Override for engines that support in-place compaction.
Implementation
@override
Future<int> compact(String table, {required Duration horizon}) async {
final cutoff = Hlc(DateTime.now().toUtc().subtract(horizon), 0, _nodeId);
_open.execute(
'DELETE FROM crdt_records '
'WHERE collection = ? AND is_deleted = 1 AND hlc_key < ?',
[table, _hlcKey(cutoff)],
);
final removed = _open.updatedRows;
if (removed > 0) _emit(table);
return removed;
}