Struct Plugin Runtime
Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker.
Cloneable high-level runtime handle for host APIs available to native plugins.
Implementations
impl PluginRuntime
impl PluginRuntime
new
pub fn new(host: &NemoRelayNativeHostApiV1) -> Self
Creates a runtime handle from the host ABI table.
list_runtime_registrations
pub fn list_runtime_registrations(
&self,
kinds: Option<&BTreeSet<RuntimeRegistrationKind>>,
) -> Result<Vec<RuntimeRegistrationIdentity>>
Lists global gateable runtime registrations.
register_conditional_middleware_guardrail
pub fn register_conditional_middleware_guardrail<F>(
&self,
name: &str,
kinds: &BTreeSet<RuntimeRegistrationKind>,
registration_name: &str,
callback: F,
) -> Result<ConditionalMiddlewareGuardrailHandle>where
F: Fn(&BTreeSet<RuntimeRegistrationKind>, &str) -> Option<String> + Send + Sync + 'static,
Registers an activation-owned callback eligibility gate.
Return Some(reason) to disable the matching target or None to leave it enabled.
deregister_conditional_middleware_guardrail
pub fn deregister_conditional_middleware_guardrail(
&self,
handle: &ConditionalMiddlewareGuardrailHandle,
) -> Result<bool>
Deregisters an activation-owned eligibility gate.
host_api
pub fn host_api(&self) -> &NemoRelayNativeHostApiV1
Returns the underlying host ABI table.
current_scope
pub fn current_scope(&self) -> Result<ScopeHandle<'_>>
Retrieves the current scope handle.
push_scope
pub fn push_scope(
&self,
name: &str,
scope_type: ScopeType,
data: Option<&Json>,
metadata: Option<&Json>,
input: Option<&Json>,
) -> Result<ScopeHandle<'_>>
Pushes a scope and emits its start event.
pop_scope
pub fn pop_scope(
&self,
handle: &ScopeHandle<'_>,
output: Option<&Json>,
metadata: Option<&Json>,
) -> Result<()>
Pops a scope and emits its end event.
scope
pub fn scope(
&self,
name: &str,
scope_type: ScopeType,
data: Option<&Json>,
metadata: Option<&Json>,
input: Option<&Json>,
) -> Result<ScopeGuard<'_>>
Opens a scope that is popped automatically when the guard is closed or dropped.
emit_mark
pub fn emit_mark(
&self,
name: &str,
data: Option<&Json>,
metadata: Option<&Json>,
) -> Result<()>
Emits a mark event under the current scope.
emit_mark_with_options
pub fn emit_mark_with_options(
&self,
name: &str,
data: Option<&Json>,
metadata: Option<&Json>,
data_schema: Option<&DataSchema>,
severity: Option<LogSeverity>,
) -> Result<()>
Emits a mark event with an optional data schema and telemetry severity.
Hosts without the ABI-v4 mark extension accept this call only when both new options are absent, in which case the legacy function is used.
emit_metric
pub fn emit_metric(
&self,
name: &str,
measurements: Vec<MetricMeasurement>,
metadata: Option<&Json>,
) -> Result<()>
Emits a validated Relay metric-measurement mark under the current scope.
runtime_diagnostics
pub fn runtime_diagnostics(&self) -> Result<RuntimeDiagnostics>
Return a bounded snapshot of active host runtime diagnostics.
create_scope_stack
pub fn create_scope_stack(&self) -> Result<ScopeStack<'_>>
Creates a new independent scope stack.
capture_scope_stack_thread
pub fn capture_scope_stack_thread(&self) -> Result<ScopeStackBinding<'_>>
Captures the current thread-local scope-stack binding.
scope_stack_active
pub fn scope_stack_active(&self) -> bool
Returns whether the current context has an explicitly active scope stack.
bind_scope_stack_thread
pub fn bind_scope_stack_thread<'a>(
&'a self,
stack: &'a ScopeStack<'a>,
) -> Result<ThreadScopeStackGuard<'a>>
Binds stack to the current OS thread until the returned guard is dropped.
Trait Implementations
impl Clone for PluginRuntime
impl Clone for PluginRuntime
clone
fn clone(&self) -> Self
clone_from
fn clone_from(&mut self, source: &Self)
impl Drop for PluginRuntime
impl Drop for PluginRuntime
drop
fn drop(&mut self)
impl Send for PluginRuntime
impl Send for PluginRuntime
impl Sync for PluginRuntime
impl Sync for PluginRuntime