pub struct PluginRuntime { /* private fields */ }Expand description
Cloneable high-level runtime handle for host APIs available to native plugins.
Implementations§
Source§impl PluginRuntime
impl PluginRuntime
Sourcepub fn new(host: &NemoRelayNativeHostApiV1) -> Self
pub fn new(host: &NemoRelayNativeHostApiV1) -> Self
Creates a runtime handle from the host ABI table.
Sourcepub fn list_runtime_registrations(
&self,
kinds: Option<&BTreeSet<RuntimeRegistrationKind>>,
) -> Result<Vec<RuntimeRegistrationIdentity>>
pub fn list_runtime_registrations( &self, kinds: Option<&BTreeSet<RuntimeRegistrationKind>>, ) -> Result<Vec<RuntimeRegistrationIdentity>>
Lists global gateable runtime registrations.
Sourcepub fn register_conditional_middleware_guardrail<F>(
&self,
name: &str,
kinds: &BTreeSet<RuntimeRegistrationKind>,
registration_name: &str,
callback: F,
) -> Result<ConditionalMiddlewareGuardrailHandle>
pub fn register_conditional_middleware_guardrail<F>( &self, name: &str, kinds: &BTreeSet<RuntimeRegistrationKind>, registration_name: &str, callback: F, ) -> Result<ConditionalMiddlewareGuardrailHandle>
Registers an activation-owned callback eligibility gate.
Return Some(reason) to disable the matching target or None to leave
it enabled.
Sourcepub fn deregister_conditional_middleware_guardrail(
&self,
handle: &ConditionalMiddlewareGuardrailHandle,
) -> Result<bool>
pub fn deregister_conditional_middleware_guardrail( &self, handle: &ConditionalMiddlewareGuardrailHandle, ) -> Result<bool>
Deregisters an activation-owned eligibility gate.
Sourcepub fn host_api(&self) -> &NemoRelayNativeHostApiV1
pub fn host_api(&self) -> &NemoRelayNativeHostApiV1
Returns the underlying host ABI table.
Sourcepub fn current_scope(&self) -> Result<ScopeHandle<'_>>
pub fn current_scope(&self) -> Result<ScopeHandle<'_>>
Retrieves the current scope handle.
Sourcepub fn push_scope(
&self,
name: &str,
scope_type: ScopeType,
data: Option<&Json>,
metadata: Option<&Json>,
input: Option<&Json>,
) -> Result<ScopeHandle<'_>>
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.
Sourcepub fn pop_scope(
&self,
handle: &ScopeHandle<'_>,
output: Option<&Json>,
metadata: Option<&Json>,
) -> Result<()>
pub fn pop_scope( &self, handle: &ScopeHandle<'_>, output: Option<&Json>, metadata: Option<&Json>, ) -> Result<()>
Pops a scope and emits its end event.
Sourcepub fn scope(
&self,
name: &str,
scope_type: ScopeType,
data: Option<&Json>,
metadata: Option<&Json>,
input: Option<&Json>,
) -> Result<ScopeGuard<'_>>
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.
Sourcepub fn emit_mark(
&self,
name: &str,
data: Option<&Json>,
metadata: Option<&Json>,
) -> Result<()>
pub fn emit_mark( &self, name: &str, data: Option<&Json>, metadata: Option<&Json>, ) -> Result<()>
Emits a mark event under the current scope.
Sourcepub fn emit_mark_with_options(
&self,
name: &str,
data: Option<&Json>,
metadata: Option<&Json>,
data_schema: Option<&DataSchema>,
severity: Option<LogSeverity>,
) -> Result<()>
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.
Sourcepub fn emit_metric(
&self,
name: &str,
measurements: Vec<MetricMeasurement>,
metadata: Option<&Json>,
) -> Result<()>
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.
Sourcepub fn runtime_diagnostics(&self) -> Result<RuntimeDiagnostics>
pub fn runtime_diagnostics(&self) -> Result<RuntimeDiagnostics>
Return a bounded snapshot of active host runtime diagnostics.
Sourcepub fn create_scope_stack(&self) -> Result<ScopeStack<'_>>
pub fn create_scope_stack(&self) -> Result<ScopeStack<'_>>
Creates a new independent scope stack.
Sourcepub fn capture_scope_stack_thread(&self) -> Result<ScopeStackBinding<'_>>
pub fn capture_scope_stack_thread(&self) -> Result<ScopeStackBinding<'_>>
Captures the current thread-local scope-stack binding.
Sourcepub fn scope_stack_active(&self) -> bool
pub fn scope_stack_active(&self) -> bool
Returns whether the current context has an explicitly active scope stack.
Sourcepub fn bind_scope_stack_thread<'a>(
&'a self,
stack: &'a ScopeStack<'a>,
) -> Result<ThreadScopeStackGuard<'a>>
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.