From 1d502ee9a26f2269f868e2c1b352305b5a7ee722 Mon Sep 17 00:00:00 2001 From: "Johan B.W. de Vries" Date: Mon, 10 Apr 2023 15:29:36 +0200 Subject: [PATCH] Remove old code --- phasmplatform/worker/runner.py | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 phasmplatform/worker/runner.py 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