vacuum method
Implementation
Future<int> vacuum({required int oldestActiveTxnId}) async {
int reclaimed = 0;
for (final pid in await _allPageIds()) {
final page = await _getPage(pid);
bool modified = false;
for (final t in page.scanTuples()) {
final xmax = TupleCodec.peekXmax(t.data);
if (xmax != 0 && xmax < oldestActiveTxnId) {
page.tombstone(t.slotIdx);
modified = true;
reclaimed++;
}
}
if (modified) {
page.compact();
await _putPage(page);
}
}
return reclaimed;
}