You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implementation of service that will periodically purge database. It
preserves slots after latest snapshots + some interval after , that
depends on user configuration of `desired-size` field. Estimation
function for interval is
`EphemeralConfig::estimate_purge_slot_interval`. Using that interval,
there will be a periodic cleaning of slots prior to
`latest_snapshot_slot - interval ` once deserized size reached.
Since implementation may change in the future, I added
`FinalityProvider` that for now just provides `latest_snapshot_slot `,
put may in the future be changed to provide latest final slot.
<!-- greptile_comment -->
## Greptile Summary
Implemented a ledger purging service called "Ledger Purgatory" that
periodically cleans up old database slots while preserving recent
history based on snapshot slots and configurable size limits.
- Added `LedgerPurgatory` service in
`/magicblock-ledger/src/ledger_purgatory.rs` that safely purges slots
before `latest_snapshot_slot - slots_to_preserve`
- Introduced `FinalityProvider` trait and implementation that currently
uses latest snapshot slot but is extensible for future finality
mechanisms
- Added `desired_size` configuration in `LedgerConfig` to control
purging interval based on estimated transaction sizes
- Implemented chunked purging in `store/api.rs` to avoid overwhelming
RocksDB when cleaning up large ranges of slots
- Added comprehensive tests in `tests/ledger_purgatory.rs` covering
various purging scenarios and edge cases
The implementation appears sound but would benefit from additional
documentation around the purging strategy and configuration options.
<sub>💡 (2/5) Greptile learns from your feedback when you react with
👍/👎!</sub>
<!-- /greptile_comment -->
---------
Co-authored-by: Babur Makhmudov <bmuddha13@gmail.com>
Co-authored-by: Thorsten Lorenz <thlorenz@gmx.de>
0 commit comments