pub struct ExecutorRegistry { /* private fields */ }Expand description
Maps HookConfig → Arc<dyn HookExecutor>. Built once per
hooks.toml load (see src/hooks/config.rs::spawn_reload_task)
and held behind the same Arc<RwLock<…>> that owns the config
snapshot. G5’s chain runner consumes the registry’s outputs.
The cache is keyed on HookConfig (full struct equality) so two
different hooks pointing at the same binary still get distinct
executors — one daemon child per [[hook]] block, never shared.
Sharing would let one event’s slow fire starve another’s
connection mutex, which is the opposite of what daemon mode
buys us.
Backed by a Vec<(HookConfig, …)> rather than a HashMap:
HookConfig carries a PathBuf and a String (no Hash
derivation today), and the cache cardinality is bounded by the
number of [[hook]] blocks in hooks.toml — a linear scan over
a few dozen entries is dwarfed by the spawn cost it gates.
Implementations§
Source§impl ExecutorRegistry
impl ExecutorRegistry
pub fn new() -> Self
Sourcepub fn from_hooks(hooks: &[HookConfig]) -> Self
pub fn from_hooks(hooks: &[HookConfig]) -> Self
Build a registry pre-populated with one executor per entry
in hooks. Convenience for the bootstrap path; callers
driving the SIGHUP reload should call Self::get lazily
instead so dropping a [[hook]] from the config tears down
its long-lived child.
Sourcepub fn get(&mut self, hook: &HookConfig) -> Arc<dyn HookExecutor> ⓘ
pub fn get(&mut self, hook: &HookConfig) -> Arc<dyn HookExecutor> ⓘ
Return the executor for hook, constructing one on first
touch. Subsequent calls with an equal HookConfig return
the same Arc.
Sourcepub fn metrics(&self) -> Vec<(HookConfig, ExecutorMetrics)>
pub fn metrics(&self) -> Vec<(HookConfig, ExecutorMetrics)>
Iterate (HookConfig, ExecutorMetrics) pairs. ai-memory doctor --tokens --hooks calls this to render the
per-executor backpressure table.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ExecutorRegistry
impl !UnwindSafe for ExecutorRegistry
impl Freeze for ExecutorRegistry
impl Send for ExecutorRegistry
impl Sync for ExecutorRegistry
impl Unpin for ExecutorRegistry
impl UnsafeUnpin for ExecutorRegistry
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more