Class PanamaComponentLinker<T>
java.lang.Object
ai.tegmentum.wasmtime4j.panama.PanamaComponentLinker<T>
- Type Parameters:
T- the type of user data associated with stores used with this linker
- All Implemented Interfaces:
ai.tegmentum.wasmtime4j.component.ComponentLinker<T>,Closeable,AutoCloseable
public final class PanamaComponentLinker<T>
extends Object
implements ai.tegmentum.wasmtime4j.component.ComponentLinker<T>
Panama FFI implementation of ComponentLinker for WebAssembly Component Model.
This implementation uses Panama Foreign Function API to interact with the native Wasmtime library for Component Model operations.
- Since:
- 1.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionPanamaComponentLinker(PanamaEngine engine) Creates a new Panama component linker. -
Method Summary
Modifier and TypeMethodDescriptionvoidaliasInterface(String fromNamespace, String fromInterface, String toNamespace, String toInterface) voidallowShadowing(boolean allow) voidclose()voiddefineFunction(String witPath, ai.tegmentum.wasmtime4j.component.ComponentHostFunction implementation) voiddefineFunction(String interfaceNamespace, String interfaceName, String functionName, ai.tegmentum.wasmtime4j.component.ComponentHostFunction implementation) voiddefineFunctionAsync(String witPath, ai.tegmentum.wasmtime4j.component.ComponentHostFunction implementation) voiddefineFunctionAsync(String interfaceNamespace, String interfaceName, String functionName, ai.tegmentum.wasmtime4j.component.ComponentHostFunction implementation) voiddefineInterface(String interfaceNamespace, String interfaceName, Map<String, ai.tegmentum.wasmtime4j.component.ComponentHostFunction> functions) voiddefineModule(String instancePath, String name, ai.tegmentum.wasmtime4j.Module module) voiddefineResource(String interfaceNamespace, String interfaceName, String resourceName, ai.tegmentum.wasmtime4j.component.ComponentResourceDefinition<?> resourceDefinition) voiddefineUnknownImportsAsTraps(ai.tegmentum.wasmtime4j.component.Component component) voidvoidvoidenableWasiHttp(ai.tegmentum.wasmtime4j.wasi.http.WasiHttpConfig config) voidvoidvoidvoidenableWasiPreview2(ai.tegmentum.wasmtime4j.wasi.WasiPreview2Config config) getDefinedFunctions(String interfaceNamespace, String interfaceName) ai.tegmentum.wasmtime4j.EngineintintGets the native component linker pointer.booleanhasFunction(String interfaceNamespace, String interfaceName, String functionName) booleanhasInterface(String interfaceNamespace, String interfaceName) ai.tegmentum.wasmtime4j.component.ComponentInstanceinstantiate(ai.tegmentum.wasmtime4j.Store store, ai.tegmentum.wasmtime4j.component.Component component) ai.tegmentum.wasmtime4j.component.ComponentInstancePreinstantiatePre(ai.tegmentum.wasmtime4j.component.Component component) booleanisValid()booleanbooleanai.tegmentum.wasmtime4j.component.ComponentInstancelinkComponent(ai.tegmentum.wasmtime4j.Store store, ai.tegmentum.wasmtime4j.component.Component component) voidlinkInstance(ai.tegmentum.wasmtime4j.component.ComponentInstance instance) voidsetAsyncSupport(boolean enabled) voidsetConfigVariables(Map<String, String> variables) voidsetWasiMaxRandomSize(long maxSize) ai.tegmentum.wasmtime4j.component.ComponentTypeInfosubstitutedComponentType(ai.tegmentum.wasmtime4j.component.Component component) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ai.tegmentum.wasmtime4j.component.ComponentLinker
instantiateAsync, root, setComponentResourceLimits
-
Constructor Details
-
PanamaComponentLinker
public PanamaComponentLinker(PanamaEngine engine) throws ai.tegmentum.wasmtime4j.exception.WasmException Creates a new Panama component linker.- Parameters:
engine- the engine to create the linker for- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException- if linker creation fails
-
-
Method Details
-
defineFunction
public void defineFunction(String interfaceNamespace, String interfaceName, String functionName, ai.tegmentum.wasmtime4j.component.ComponentHostFunction implementation) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
defineFunctionin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
defineFunction
public void defineFunction(String witPath, ai.tegmentum.wasmtime4j.component.ComponentHostFunction implementation) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
defineFunctionin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
defineFunctionAsync
public void defineFunctionAsync(String interfaceNamespace, String interfaceName, String functionName, ai.tegmentum.wasmtime4j.component.ComponentHostFunction implementation) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
defineFunctionAsyncin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
defineFunctionAsync
public void defineFunctionAsync(String witPath, ai.tegmentum.wasmtime4j.component.ComponentHostFunction implementation) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
defineFunctionAsyncin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
defineInterface
public void defineInterface(String interfaceNamespace, String interfaceName, Map<String, ai.tegmentum.wasmtime4j.component.ComponentHostFunction> functions) throws ai.tegmentum.wasmtime4j.exception.WasmException- Specified by:
defineInterfacein interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
defineResource
public void defineResource(String interfaceNamespace, String interfaceName, String resourceName, ai.tegmentum.wasmtime4j.component.ComponentResourceDefinition<?> resourceDefinition) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
defineResourcein interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
defineModule
public void defineModule(String instancePath, String name, ai.tegmentum.wasmtime4j.Module module) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
defineModulein interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
linkInstance
public void linkInstance(ai.tegmentum.wasmtime4j.component.ComponentInstance instance) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
linkInstancein interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
linkComponent
public ai.tegmentum.wasmtime4j.component.ComponentInstance linkComponent(ai.tegmentum.wasmtime4j.Store store, ai.tegmentum.wasmtime4j.component.Component component) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
linkComponentin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
instantiatePre
public ai.tegmentum.wasmtime4j.component.ComponentInstancePre instantiatePre(ai.tegmentum.wasmtime4j.component.Component component) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
instantiatePrein interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
instantiate
public ai.tegmentum.wasmtime4j.component.ComponentInstance instantiate(ai.tegmentum.wasmtime4j.Store store, ai.tegmentum.wasmtime4j.component.Component component) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
instantiatein interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
enableWasiPreview2
public void enableWasiPreview2() throws ai.tegmentum.wasmtime4j.exception.WasmException- Specified by:
enableWasiPreview2in interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
enableWasiPreview2
public void enableWasiPreview2(ai.tegmentum.wasmtime4j.wasi.WasiPreview2Config config) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
enableWasiPreview2in interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
enableWasiHttp
public void enableWasiHttp() throws ai.tegmentum.wasmtime4j.exception.WasmException- Specified by:
enableWasiHttpin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
enableWasiHttp
public void enableWasiHttp(ai.tegmentum.wasmtime4j.wasi.http.WasiHttpConfig config) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
enableWasiHttpin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
enableWasiP3
public void enableWasiP3() throws ai.tegmentum.wasmtime4j.exception.WasmException- Specified by:
enableWasiP3in interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
enableWasiHttpP3
public void enableWasiHttpP3() throws ai.tegmentum.wasmtime4j.exception.WasmException- Specified by:
enableWasiHttpP3in interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
enableWasiConfig
public void enableWasiConfig() throws ai.tegmentum.wasmtime4j.exception.WasmException- Specified by:
enableWasiConfigin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
setConfigVariables
-
getEngine
public ai.tegmentum.wasmtime4j.Engine getEngine()- Specified by:
getEnginein interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>
-
isValid
public boolean isValid()- Specified by:
isValidin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>
-
hasInterface
-
hasFunction
-
getDefinedInterfaces
-
getDefinedFunctions
-
isWasiP2Enabled
public boolean isWasiP2Enabled()- Specified by:
isWasiP2Enabledin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>
-
isWasiHttpEnabled
public boolean isWasiHttpEnabled()- Specified by:
isWasiHttpEnabledin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>
-
getHostFunctionCount
public int getHostFunctionCount()- Specified by:
getHostFunctionCountin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>
-
getInterfaceCount
public int getInterfaceCount()- Specified by:
getInterfaceCountin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>
-
setAsyncSupport
public void setAsyncSupport(boolean enabled) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
setAsyncSupportin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
setWasiMaxRandomSize
public void setWasiMaxRandomSize(long maxSize) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
setWasiMaxRandomSizein interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
aliasInterface
public void aliasInterface(String fromNamespace, String fromInterface, String toNamespace, String toInterface) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
aliasInterfacein interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
allowShadowing
public void allowShadowing(boolean allow) - Specified by:
allowShadowingin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>
-
defineUnknownImportsAsTraps
public void defineUnknownImportsAsTraps(ai.tegmentum.wasmtime4j.component.Component component) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
defineUnknownImportsAsTrapsin interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
substitutedComponentType
public ai.tegmentum.wasmtime4j.component.ComponentTypeInfo substitutedComponentType(ai.tegmentum.wasmtime4j.component.Component component) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
substitutedComponentTypein interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceai.tegmentum.wasmtime4j.component.ComponentLinker<T>
-
getNativeLinker
Gets the native component linker pointer.- Returns:
- native linker memory segment
-