pub struct EventActor { /* private fields */ }Expand description
The per-plugin actor: owns the Store + events bindings for the plugin’s
life and drives on-event for each delivery the bus pushes onto its channel.
Construct via PluginHost::spawn_event_plugin; drive by spawning
run on a multi-thread runtime.
Implementations§
Source§impl EventActor
impl EventActor
Sourcepub fn with_tracer(self, tracer: Option<PluginTracerHandle>) -> Self
pub fn with_tracer(self, tracer: Option<PluginTracerHandle>) -> Self
PO.2: attach the boundary tracer (the loader calls this before spawning run()). Off the hot path — the seam is async.
Sourcepub async fn run(self)
pub async fn run(self)
Drive the actor to completion. Delivers each event in arrival order; the
loop ends when the channel closes (every subscription removed / pruned),
dropping the Store. A delivery that traps does not end the loop and
does not crash the host — the trap is caught, logged, and the loop
continues (§8). Note a component trap taints its instance: this plugin’s
subsequent deliveries then also fail (each logged + skipped), so a
trapping plugin is effectively dead until it is re-instantiated
(quarantine / reload is PH7.12). The guarantee held here is isolation:
the publisher, the bus, every other subscriber, and every other plugin are
untouched — only the trapping plugin degrades.
OC.2 gave the loop a second mouth. Besides bus deliveries it drains a
set of pending wake-every sleeps, firing on-wake(id) for each and
re-arming it. Both inputs land on this one task, so a wake is bounded by
the same budget, tripped by the same quarantine and dropped by the same
task abort as an event — none of which had to be re-implemented for it.
The loop now ends when the channel is closed and nothing is armed. A
plugin that subscribes to nothing but arms a wake is a legitimate shape
(org’s clock does exactly that between clock-in and clock-out), and under
the old while let Some(..) its actor would have exited before the first
tick.
Auto Trait Implementations§
impl !RefUnwindSafe for EventActor
impl !Sync for EventActor
impl !UnwindSafe for EventActor
impl Freeze for EventActor
impl Send for EventActor
impl Unpin for EventActor
impl UnsafeUnpin for EventActor
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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