Skip to main content

SharedEngine

Type Alias SharedEngine 

Source
pub type SharedEngine = Arc<RwLock<EvolutionEngine>>;
Expand description

Shared engine pointer — what the proxy and any future shared-state worker pool should hold.

Use this instead of Clone whenever multiple async tasks need access to the same engine’s cache + corpus + gene_stats. Cloning the Arc is O(1); cloning the engine itself is O(grid + archive + gene_stats) and produces an independent engine with a fresh (empty) cache.

Locking discipline:

  • hot read paths (cache hits, diversity_score, best()) → read()
  • mutation paths (submit_evaluations, gene_stats updates, checkpoint persistence) → write()
  • never hold the write lock across an await that performs network I/O — drop it before the await, re-acquire after

Aliased Type§

pub struct SharedEngine { /* private fields */ }