recordCompaction method

void recordCompaction(
  1. String id, {
  2. required int freedTokens,
})

Records a completed proactive compaction (issue #439): bumps the counter, stamps the freed-token count and the time, and persists — unlike notePressure this is a durable lifecycle fact.

Implementation

void recordCompaction(String id, {required int freedTokens}) {
  final handle = _handles[id];
  if (handle == null || freedTokens <= 0) return;
  handle.compactions++;
  handle.lastCompactionFreed = freedTokens;
  final now = clock().toIso8601String();
  handle.lastCompactionAt = now;
  handle.lastActivity = now;
  _emit(handle);
  _persist();
}