Skip to main content

RuleSwapBackend

Trait RuleSwapBackend 

Source
pub trait RuleSwapBackend: Send + Sync {
    // Required methods
    fn pre_stage(&self, rule: &CompiledRule) -> Result<(), RuleError>;
    fn quiesce(&self, rule_id: &str, version: u64) -> Result<u64, RuleError>;
    fn swap(&self, rule_id: &str, new_version: u64) -> Result<(), RuleError>;
    fn terminate_old(
        &self,
        rule_id: &str,
        old_version: u64,
    ) -> Result<(), RuleError>;
}
Expand description

Pluggable GPU-side swap backend.

The registry is hardware-agnostic; concrete backends drive actual CUDA module loading, actor quiescing, and atomic pointer swaps.

Default implementation is NoopSwapBackend — it returns success instantly for every method, which is useful for unit tests and for the v1.1 pre-hardware development phase.

Required Methods§

Source

fn pre_stage(&self, rule: &CompiledRule) -> Result<(), RuleError>

Pre-stage a rule artifact on the device (e.g. load the PTX into a CUDA module but do not yet make it the active actor). Called before quiesce.

Source

fn quiesce(&self, rule_id: &str, version: u64) -> Result<u64, RuleError>

Quiesce the old actor. Returns the count of messages drained. Called only for reload / rollback, not for register.

Source

fn swap(&self, rule_id: &str, new_version: u64) -> Result<(), RuleError>

Perform the atomic pointer swap that activates new_version.

Source

fn terminate_old( &self, rule_id: &str, old_version: u64, ) -> Result<(), RuleError>

Terminate the old actor after the grace period.

Implementors§