pub struct EventSinkEmitter {
pub runtime_handle: Handle,
pub sink: Arc<dyn EventSink>,
pub jsonl_sink: Option<Arc<dyn EventSink>>,
}Expand description
Adapter from the proxy’s synchronous DnsQueryEmitter trait to the
supervisor’s async cellos_core::ports::EventSink pipeline.
Tokio-context constraint: runtime_handle MUST be captured on a
thread that already has a tokio runtime context (i.e. inside an async
block on the multi-thread runtime, OR inside spawn_blocking). The
proxy thread itself is a bare std::thread and has no tokio context;
the captured handle is what lets it spawn work back onto the runtime.
Fields§
§runtime_handle: Handle§sink: Arc<dyn EventSink>§jsonl_sink: Option<Arc<dyn EventSink>>Implementations§
Source§impl EventSinkEmitter
impl EventSinkEmitter
Sourcepub fn capture_current(
sink: Arc<dyn EventSink>,
jsonl_sink: Option<Arc<dyn EventSink>>,
) -> Self
pub fn capture_current( sink: Arc<dyn EventSink>, jsonl_sink: Option<Arc<dyn EventSink>>, ) -> Self
Build an emitter capturing the current tokio runtime handle.
Call from inside an async block (or spawn_blocking) — never from
a bare std thread. Panics with a clear message if no tokio runtime
is reachable, which is a programming error: this struct exists
specifically to bridge from sync threads, but the bridge itself
must be constructed where a runtime is available.
Trait Implementations§
Source§impl DnsQueryEmitter for EventSinkEmitter
impl DnsQueryEmitter for EventSinkEmitter
Source§fn emit(&self, event: CloudEventV1)
fn emit(&self, event: CloudEventV1)
Auto Trait Implementations§
impl Freeze for EventSinkEmitter
impl !RefUnwindSafe for EventSinkEmitter
impl Send for EventSinkEmitter
impl Sync for EventSinkEmitter
impl Unpin for EventSinkEmitter
impl UnsafeUnpin for EventSinkEmitter
impl !UnwindSafe for EventSinkEmitter
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
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