Skip to main content

Condenser

Trait Condenser 

Source
pub trait Condenser: Send + Sync {
    // Required methods
    fn should_condense(
        &self,
        state: &ReconstructedState,
        budget_used_fraction: f64,
    ) -> impl Future<Output = bool> + Send;
    fn condense(
        &self,
        events: &[SessionEventEnvelope],
        last_condensed_seq: u64,
    ) -> impl Future<Output = Result<CondensationResult, SessionError>> + Send;
}
Expand description

Computes whether and how to durably condense a session’s event log.

Implementors MUST respect INV-SP-4 (spec §8.3): the range returned by Self::condense must start strictly after the caller’s last_condensed_seq — see validate_non_overlap.

Required Methods§

Source

fn should_condense( &self, state: &ReconstructedState, budget_used_fraction: f64, ) -> impl Future<Output = bool> + Send

Returns true if the reconstructed context has grown enough (relative to budget_used_fraction, the fraction of the context budget currently consumed) to warrant a condensation pass.

Source

fn condense( &self, events: &[SessionEventEnvelope], last_condensed_seq: u64, ) -> impl Future<Output = Result<CondensationResult, SessionError>> + Send

Condense events (typically the tail since last_condensed_seq), producing a CondensationResult whose replaced_range starts strictly after last_condensed_seq.

§Errors

Returns an error if summarization fails or the computed range would violate INV-SP-4.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§