Package io.roastedroot.proxywasm
Interface PluginFactory
-
public interface PluginFactoryA functional interface representing a factory for creatingPlugininstances.This is typically used in scenarios where plugin instantiation needs to be deferred or customized, potentially based on configuration or context available at runtime. Implementations might handle loading WASM modules, configuring builders, and returning the ready-to-use plugin.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classPluginFactory.BuilderBuilder for creating a PluginFactory instance that can create Plugin instances with pre-configured settings.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static PluginFactory.Builderbuilder(WasmModule module)Creates a newPluginFactory.Builderto configure and construct aPluginFactoryinstance from the given WASM module.Plugincreate()Creates and returns a newPlugininstance.Stringname()Returns the configured name of the plugin.booleanshared()Indicates whether this plugin instance is shared across multiple contexts or requests.
-
-
-
Method Detail
-
create
Plugin create() throws Exception
Creates and returns a newPlugininstance. Implementations are responsible for all necessary setup, including potentially loading the WASM module and configuring it usingbuilder(com.dylibso.chicory.wasm.WasmModule).
-
name
String name()
Returns the configured name of the plugin.- Returns:
- the plugin name.
-
shared
boolean shared()
Indicates whether this plugin instance is shared across multiple contexts or requests.If
true, the plugin will be instantiated once and reused, allowing it to maintain state between requests but potentially introducing contention. Iffalse, a new instance will be created for each request or context, providing better isolation but consuming more memory.- Returns:
trueif the plugin instance is shared,falseotherwise.
-
builder
static PluginFactory.Builder builder(WasmModule module)
Creates a newPluginFactory.Builderto configure and construct aPluginFactoryinstance from the given WASM module.- Parameters:
module- the compiledWasmModulerepresenting the plugin's code.- Returns:
- a new
PluginFactory.Builderinstance.
-
-