diff --git a/phasmplatform/worker/runner.py b/phasmplatform/worker/runner.py deleted file mode 100644 index 402f66a..0000000 --- a/phasmplatform/worker/runner.py +++ /dev/null @@ -1,28 +0,0 @@ -import wasm3 # type: ignore - -from phasmplatform.common.exceptions import PhashPlatformNonIntMainReturnError - - -def post_message(namespace: int, topic: int, kind: int, body: int) -> None: - print('namespace', namespace) - print('topic', topic) - print('kind', kind) - print('body', body) - - -def run_once_wasm3(wasm_bin: bytes) -> int: - env = wasm3.Environment() - rtime = env.new_runtime(1024 * 1024) - - mod = env.parse_module(wasm_bin) - mod.link_function('imports', 'post_message', post_message) - - rtime.load(mod) - result = rtime.find_function('handle_message')() - if result is None: - return 0 - - if not isinstance(result, int): - raise PhashPlatformNonIntMainReturnError(result) - - return result