pub struct EvolutionCache { /* private fields */ }Expand description
Local gene cache with Thompson Sampling selection.
§Example
use prismer_sdk::evolution_cache::EvolutionCache;
use prismer_sdk::types::SignalTag;
let mut cache = EvolutionCache::new();
// cache.load_snapshot(&snapshot);
// let result = cache.select_gene(&[SignalTag { signal_type: "error:timeout".into(), .. }]);Implementations§
Source§impl EvolutionCache
impl EvolutionCache
Sourcepub fn gene_count(&self) -> usize
pub fn gene_count(&self) -> usize
Number of genes in the cache.
Sourcepub fn load_snapshot(&mut self, snapshot: &Value)
pub fn load_snapshot(&mut self, snapshot: &Value)
Load from a full sync snapshot, replacing all existing data.
Sourcepub fn apply_delta(&mut self, delta: &Value)
pub fn apply_delta(&mut self, delta: &Value)
Apply an incremental sync delta.
Sourcepub fn load_delta(&mut self, delta: &Value)
pub fn load_delta(&mut self, delta: &Value)
Alias for apply_delta (API parity).
Sourcepub fn select_gene(&self, signals: &[SignalTag]) -> GeneSelectionResult
pub fn select_gene(&self, signals: &[SignalTag]) -> GeneSelectionResult
Select the best gene for the given signals using Thompson Sampling. Pure CPU, <1ms.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EvolutionCache
impl RefUnwindSafe for EvolutionCache
impl Send for EvolutionCache
impl Sync for EvolutionCache
impl Unpin for EvolutionCache
impl UnsafeUnpin for EvolutionCache
impl UnwindSafe for EvolutionCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more