pub struct InstancePool { /* private fields */ }Expand description
Pool of WASM plugin instances.
Maintains a cache of compiled modules and manages instance creation.
Implementations§
Source§impl InstancePool
impl InstancePool
Sourcepub fn new(engine: Arc<WasmEngine>, limits: PluginLimits) -> Self
pub fn new(engine: Arc<WasmEngine>, limits: PluginLimits) -> Self
Create a new instance pool.
Sourcepub fn with_http_client(
engine: Arc<WasmEngine>,
limits: PluginLimits,
http_client: Arc<HttpClient>,
) -> Self
pub fn with_http_client( engine: Arc<WasmEngine>, limits: PluginLimits, http_client: Arc<HttpClient>, ) -> Self
Create a new instance pool with an HTTP client for outbound calls.
Sourcepub fn with_http_client_and_secrets(
engine: Arc<WasmEngine>,
limits: PluginLimits,
http_client: Arc<HttpClient>,
secrets: SecretsStore,
) -> Self
pub fn with_http_client_and_secrets( engine: Arc<WasmEngine>, limits: PluginLimits, http_client: Arc<HttpClient>, secrets: SecretsStore, ) -> Self
Create a new instance pool with HTTP client and secrets store.
Sourcepub fn with_all_options(
engine: Arc<WasmEngine>,
limits: PluginLimits,
http_client: Option<Arc<HttpClient>>,
secrets: Option<SecretsStore>,
rate_limiter: Option<RateLimiter>,
response_cache: Option<ResponseCache>,
nats_publisher: Option<Arc<NatsPublisher>>,
kafka_publisher: Option<Arc<KafkaPublisher>>,
) -> Self
pub fn with_all_options( engine: Arc<WasmEngine>, limits: PluginLimits, http_client: Option<Arc<HttpClient>>, secrets: Option<SecretsStore>, rate_limiter: Option<RateLimiter>, response_cache: Option<ResponseCache>, nats_publisher: Option<Arc<NatsPublisher>>, kafka_publisher: Option<Arc<KafkaPublisher>>, ) -> Self
Create a new instance pool with all options.
Sourcepub fn register_module(&self, module: CompiledModule)
pub fn register_module(&self, module: CompiledModule)
Register a compiled module in the pool.
Sourcepub fn register_config(&self, key: InstanceKey, config_json: Vec<u8>)
pub fn register_config(&self, key: InstanceKey, config_json: Vec<u8>)
Register a plugin config.
Sourcepub fn get_instance(
&self,
key: &InstanceKey,
) -> Result<PluginInstance, WasmError>
pub fn get_instance( &self, key: &InstanceKey, ) -> Result<PluginInstance, WasmError>
Get or create an instance for the given key.
Sourcepub fn has_plugin(&self, name: &str) -> bool
pub fn has_plugin(&self, name: &str) -> bool
Check if a plugin is registered.
Sourcepub fn body_access(&self, name: &str) -> bool
pub fn body_access(&self, name: &str) -> bool
Check if a plugin has body_access capability.
Sourcepub fn module_count(&self) -> usize
pub fn module_count(&self) -> usize
Get the number of registered modules.
Sourcepub fn instance_key_count(&self) -> usize
pub fn instance_key_count(&self) -> usize
Get the number of registered instance keys.
Auto Trait Implementations§
impl Freeze for InstancePool
impl !RefUnwindSafe for InstancePool
impl Send for InstancePool
impl Sync for InstancePool
impl Unpin for InstancePool
impl UnsafeUnpin for InstancePool
impl !UnwindSafe for InstancePool
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
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
Converts
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>
Converts
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request