PurgeExecutor

Trait PurgeExecutor 

Source
pub trait PurgeExecutor:
    Send
    + Sync
    + 'static {
    // Required method
    fn execute_purge<'life0, 'async_trait>(
        &'life0 self,
        last_included: LogId,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn validate_purge<'life0, 'async_trait>(
        &'life0 self,
        last_included: LogId,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn pre_purge<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn post_purge<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Defines the behavior for log entry compaction and physical deletion.

§Safety Requirements

Implementations MUST guarantee:

  1. All entries up to last_included.index are preserved in snapshots
  2. No concurrent modifications during purge execution
  3. Atomic persistence of purge metadata

Required Methods§

Source

fn execute_purge<'life0, 'async_trait>( &'life0 self, last_included: LogId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Physically removes log entries up to specified index (inclusive)

§Arguments
  • last_included The last log index included in the latest snapshot
§Implementation Notes
  • Should be atomic with updating last_purged_index
  • Must not delete any entries required for log matching properties

Provided Methods§

Source

fn validate_purge<'life0, 'async_trait>( &'life0 self, last_included: LogId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Validates if purge can be safely executed

§Key Characteristics
  • Stateless: Does NOT validate Raft protocol state (commit index/purge order/cluster progress)
  • Storage-focused: Performs physical storage checks (disk space/snapshot integrity/I/O health)

Default implementation checks:

  • No pending purge operations
Source

fn pre_purge<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lifecycle hook before purge execution

Use for:

  • Acquiring resource locks
  • Starting transactions
Source

fn post_purge<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lifecycle hook after purge execution

Use for:

  • Releasing resource locks
  • Finalizing transactions
  • Triggering backups

Implementors§

Source§

impl<T: TypeConfig> PurgeExecutor for DefaultPurgeExecutor<T>