Class PanamaWasiContext
java.lang.Object
ai.tegmentum.wasmtime4j.panama.PanamaWasiContext
- All Implemented Interfaces:
ai.tegmentum.wasmtime4j.wasi.WasiContext
public final class PanamaWasiContext
extends Object
implements ai.tegmentum.wasmtime4j.wasi.WasiContext
Panama FFI implementation of WasiContext.
Provides WASI context functionality using Panama Foreign Function API bindings to the native Wasmtime WASI implementation.
- Since:
- 1.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this WASI context and releases native resources.ai.tegmentum.wasmtime4j.wasi.WasiContextlongReturns the async timeout in milliseconds.intReturns the max async operations limit.Gets the native context handle.Gets the native context handle.byte[]byte[]booleanbooleanai.tegmentum.wasmtime4j.wasi.WasiContextai.tegmentum.wasmtime4j.wasi.WasiContextai.tegmentum.wasmtime4j.wasi.WasiContextbooleanReturns whether async I/O is enabled.booleanReturns whether component model is enabled.booleanReturns whether network access is enabled.booleanReturns whether process spawning is enabled.ai.tegmentum.wasmtime4j.wasi.WasiContextpreopenedDir(Path hostPath, String guestPath) ai.tegmentum.wasmtime4j.wasi.WasiContextpreopenedDirReadOnly(Path hostPath, String guestPath) ai.tegmentum.wasmtime4j.wasi.WasiContextai.tegmentum.wasmtime4j.wasi.WasiContextsetAsyncIoEnabled(boolean enabled) ai.tegmentum.wasmtime4j.wasi.WasiContextsetAsyncTimeout(long timeoutMs) ai.tegmentum.wasmtime4j.wasi.WasiContextsetComponentModelEnabled(boolean enabled) ai.tegmentum.wasmtime4j.wasi.WasiContextai.tegmentum.wasmtime4j.wasi.WasiContextai.tegmentum.wasmtime4j.wasi.WasiContextsetFilesystemWorkingDir(Path workingDir) ai.tegmentum.wasmtime4j.wasi.WasiContextsetMaxAsyncOperations(int maxOps) ai.tegmentum.wasmtime4j.wasi.WasiContextsetMaxOpenFiles(int maxFds) ai.tegmentum.wasmtime4j.wasi.WasiContextsetNetworkEnabled(boolean enabled) ai.tegmentum.wasmtime4j.wasi.WasiContextsetProcessEnabled(boolean enabled) ai.tegmentum.wasmtime4j.wasi.WasiContextai.tegmentum.wasmtime4j.wasi.WasiContextsetStderrAppend(Path path) ai.tegmentum.wasmtime4j.wasi.WasiContextai.tegmentum.wasmtime4j.wasi.WasiContextsetStdinBytes(byte[] data) ai.tegmentum.wasmtime4j.wasi.WasiContextai.tegmentum.wasmtime4j.wasi.WasiContextsetStdoutAppend(Path path) ai.tegmentum.wasmtime4j.wasi.WasiContextsetWorkingDirectory(String workingDir)
-
Constructor Details
-
PanamaWasiContext
public PanamaWasiContext()Creates a new Panama WASI context.
-
-
Method Details
-
getNativeContext
Gets the native context handle.- Returns:
- the native context memory segment
-
setArgv
- Specified by:
setArgvin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
setEnv
-
setEnv
-
inheritEnv
public ai.tegmentum.wasmtime4j.wasi.WasiContext inheritEnv()- Specified by:
inheritEnvin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
inheritArgs
public ai.tegmentum.wasmtime4j.wasi.WasiContext inheritArgs()- Specified by:
inheritArgsin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
inheritStdio
public ai.tegmentum.wasmtime4j.wasi.WasiContext inheritStdio()- Specified by:
inheritStdioin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
setStdin
- Specified by:
setStdinin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
setStdinBytes
public ai.tegmentum.wasmtime4j.wasi.WasiContext setStdinBytes(byte[] data) - Specified by:
setStdinBytesin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
setStdout
- Specified by:
setStdoutin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
setStderr
- Specified by:
setStderrin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
setStdoutAppend
- Specified by:
setStdoutAppendin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
setStderrAppend
- Specified by:
setStderrAppendin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
preopenedDir
-
preopenedDirReadOnly
public ai.tegmentum.wasmtime4j.wasi.WasiContext preopenedDirReadOnly(Path hostPath, String guestPath) throws ai.tegmentum.wasmtime4j.exception.WasmException - Specified by:
preopenedDirReadOnlyin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
setWorkingDirectory
- Specified by:
setWorkingDirectoryin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
setNetworkEnabled
public ai.tegmentum.wasmtime4j.wasi.WasiContext setNetworkEnabled(boolean enabled) - Specified by:
setNetworkEnabledin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
setMaxOpenFiles
public ai.tegmentum.wasmtime4j.wasi.WasiContext setMaxOpenFiles(int maxFds) - Specified by:
setMaxOpenFilesin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
setAsyncIoEnabled
public ai.tegmentum.wasmtime4j.wasi.WasiContext setAsyncIoEnabled(boolean enabled) - Specified by:
setAsyncIoEnabledin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
setMaxAsyncOperations
public ai.tegmentum.wasmtime4j.wasi.WasiContext setMaxAsyncOperations(int maxOps) - Specified by:
setMaxAsyncOperationsin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
setAsyncTimeout
public ai.tegmentum.wasmtime4j.wasi.WasiContext setAsyncTimeout(long timeoutMs) - Specified by:
setAsyncTimeoutin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
setComponentModelEnabled
public ai.tegmentum.wasmtime4j.wasi.WasiContext setComponentModelEnabled(boolean enabled) - Specified by:
setComponentModelEnabledin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
setProcessEnabled
public ai.tegmentum.wasmtime4j.wasi.WasiContext setProcessEnabled(boolean enabled) - Specified by:
setProcessEnabledin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
setFilesystemWorkingDir
- Specified by:
setFilesystemWorkingDirin interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
isNetworkEnabled
public boolean isNetworkEnabled()Returns whether network access is enabled.- Returns:
- true if network access is enabled
-
isAsyncIoEnabled
public boolean isAsyncIoEnabled()Returns whether async I/O is enabled.- Returns:
- true if async I/O is enabled
-
isProcessEnabled
public boolean isProcessEnabled()Returns whether process spawning is enabled.- Returns:
- true if process spawning is enabled
-
isComponentModelEnabled
public boolean isComponentModelEnabled()Returns whether component model is enabled.- Returns:
- true if component model is enabled
-
getMaxAsyncOperations
public int getMaxAsyncOperations()Returns the max async operations limit.- Returns:
- the max async operations (-1 = unlimited)
-
getAsyncTimeoutMs
public long getAsyncTimeoutMs()Returns the async timeout in milliseconds.- Returns:
- the async timeout (-1 = no timeout)
-
getEnvironment
-
getArguments
-
enableOutputCapture
public ai.tegmentum.wasmtime4j.wasi.WasiContext enableOutputCapture() throws ai.tegmentum.wasmtime4j.exception.WasmException- Specified by:
enableOutputCapturein interfaceai.tegmentum.wasmtime4j.wasi.WasiContext- Throws:
ai.tegmentum.wasmtime4j.exception.WasmException
-
getStdoutCapture
public byte[] getStdoutCapture()- Specified by:
getStdoutCapturein interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
getStderrCapture
public byte[] getStderrCapture()- Specified by:
getStderrCapturein interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
hasStdoutCapture
public boolean hasStdoutCapture()- Specified by:
hasStdoutCapturein interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
hasStderrCapture
public boolean hasStderrCapture()- Specified by:
hasStderrCapturein interfaceai.tegmentum.wasmtime4j.wasi.WasiContext
-
getNativeHandle
Gets the native context handle.- Returns:
- the native context handle
-
close
public void close()Closes this WASI context and releases native resources.
-