Class PanamaComponentInstancePre

java.lang.Object
ai.tegmentum.wasmtime4j.panama.PanamaComponentInstancePre
All Implemented Interfaces:
ai.tegmentum.wasmtime4j.component.ComponentInstancePre, Closeable, AutoCloseable

public final class PanamaComponentInstancePre extends Object implements ai.tegmentum.wasmtime4j.component.ComponentInstancePre
Panama FFI implementation of ComponentInstancePre for fast repeated component instantiation.

This implementation uses Panama Foreign Function API to interact with the native Wasmtime library for pre-instantiated component operations.

Since:
1.0.0
  • Constructor Details

    • PanamaComponentInstancePre

      public PanamaComponentInstancePre(MemorySegment nativePreHandle, PanamaEngine engine, ai.tegmentum.wasmtime4j.panama.PanamaComponentImpl component)
      Creates a new Panama ComponentInstancePre.
      Parameters:
      nativePreHandle - the native pre-instantiated handle
      engine - the engine
      component - the component that was pre-instantiated
  • Method Details

    • instantiate

      public ai.tegmentum.wasmtime4j.component.ComponentInstance instantiate() throws ai.tegmentum.wasmtime4j.exception.WasmException
      Specified by:
      instantiate in interface ai.tegmentum.wasmtime4j.component.ComponentInstancePre
      Throws:
      ai.tegmentum.wasmtime4j.exception.WasmException
    • instantiate

      public ai.tegmentum.wasmtime4j.component.ComponentInstance instantiate(ai.tegmentum.wasmtime4j.component.ComponentStoreConfig config) throws ai.tegmentum.wasmtime4j.exception.WasmException
      Specified by:
      instantiate in interface ai.tegmentum.wasmtime4j.component.ComponentInstancePre
      Throws:
      ai.tegmentum.wasmtime4j.exception.WasmException
    • getEngine

      public ai.tegmentum.wasmtime4j.Engine getEngine()
      Specified by:
      getEngine in interface ai.tegmentum.wasmtime4j.component.ComponentInstancePre
    • getComponent

      public ai.tegmentum.wasmtime4j.component.Component getComponent()
      Specified by:
      getComponent in interface ai.tegmentum.wasmtime4j.component.ComponentInstancePre
    • isValid

      public boolean isValid()
      Specified by:
      isValid in interface ai.tegmentum.wasmtime4j.component.ComponentInstancePre
    • getInstanceCount

      public long getInstanceCount()
      Specified by:
      getInstanceCount in interface ai.tegmentum.wasmtime4j.component.ComponentInstancePre
    • getPreparationTimeNs

      public long getPreparationTimeNs()
      Specified by:
      getPreparationTimeNs in interface ai.tegmentum.wasmtime4j.component.ComponentInstancePre
    • getAverageInstantiationTimeNs

      public long getAverageInstantiationTimeNs()
      Specified by:
      getAverageInstantiationTimeNs in interface ai.tegmentum.wasmtime4j.component.ComponentInstancePre
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface ai.tegmentum.wasmtime4j.component.ComponentInstancePre
    • getNativeHandle

      public MemorySegment getNativeHandle()
      Gets the native handle for this pre-instantiated component.
      Returns:
      the native handle