TODO(benh): Truncation could be optimized by saving the "oldest" snapshot and only doing a truncation if/when we update that snapshot. TODO(benh): Truncation is not enough to keep the log size small as the log could get very fragmented. We'll need a way to defragment the log as some state entries might not get set over a long period of time and their associated snapshots are causing the log to gro
| 380 | // of time and their associated snapshots are causing the log to grow |
| 381 | // very big. |
| 382 | void LogStorageProcess::truncate() |
| 383 | { |
| 384 | // We lock the truncation since it includes a call to |
| 385 | // Log::Writer::truncate which must be serialized with calls to |
| 386 | // Log::Writer::append. |
| 387 | mutex.lock() |
| 388 | .then(defer(self(), &Self::_truncate)) |
| 389 | .onAny(lambda::bind(&Mutex::unlock, mutex)); |
| 390 | } |
| 391 | |
| 392 | |
| 393 | Future<Nothing> LogStorageProcess::_truncate() |