Skip to main content

player_plugin_wasm_host/
lib.rs

1#![deny(unsafe_code)]
2
3mod attributes;
4mod benchmark;
5mod bindings;
6mod capability;
7mod event_hook;
8mod host_state;
9mod invocation;
10mod runtime;
11
12pub use benchmark::{
13    WASM_PLUGIN_BENCHMARK_BATCH_QUEUE_CAPACITY, WASM_PLUGIN_BENCHMARK_REPORT_QUEUE_CAPACITY,
14    WasmBenchmarkBatchEnqueueStatus, WasmBenchmarkSinkBatchReport, WasmBenchmarkSinkFlushReport,
15    WasmBenchmarkSinkQueue, WasmBenchmarkSinkQueueReportBatch, WasmBenchmarkSinkSession,
16};
17#[doc(hidden)]
18pub use bindings::VESPER_PLUGIN_WIT;
19pub use capability::{WasmBenchmarkSinkAdapter, WasmPipelineEventHookAdapter};
20pub use event_hook::{
21    WASM_PLUGIN_EVENT_QUEUE_CAPACITY, WASM_PLUGIN_EVENT_REPORT_QUEUE_CAPACITY,
22    WasmPipelineEventEnqueueStatus, WasmPipelineEventHookQueue, WasmPipelineEventHookReport,
23    WasmPipelineEventHookReportBatch, WasmPipelineEventHookSession,
24};
25pub use host_state::{WasmPluginLogLevel, WasmPluginLogRecord};
26pub use invocation::{WasmInvocationTicket, WasmQueueLifecycle, WasmQueueSettlement};
27pub use runtime::{
28    WasmErrorCause, WasmExecutionFailure, WasmExecutionFailureKind, WasmPluginHostError,
29    WasmPluginRuntime, WasmPluginRuntimeError, WasmQueueError, WasmWaitOperation,
30};
31
32pub const MAX_WASM_PLUGIN_COMPONENT_BYTES: usize = 64 * 1024 * 1024;
33pub const MAX_WASM_PLUGIN_INPUT_BYTES: usize = 4 * 1024 * 1024;
34pub const MAX_WASM_PLUGIN_OUTPUT_BYTES: usize = 256 * 1024;
35/// Version of the fixed `vesper:plugin` Component Model contract.
36pub const WASM_PLUGIN_WIT_INTERFACE_MAJOR: u16 = 1;
37/// Minor version of the fixed `vesper:plugin` Component Model contract.
38pub const WASM_PLUGIN_WIT_INTERFACE_MINOR: u16 = 0;
39pub const WASM_PLUGIN_MEMORY_LIMIT_BYTES: usize = 64 * 1024 * 1024;
40pub const WASM_PLUGIN_MEMORY_COUNT_LIMIT: usize = 1;
41pub const WASM_PLUGIN_INSTANCE_LIMIT: usize = 32;
42pub const WASM_PLUGIN_TABLE_LIMIT: usize = 16;
43pub const WASM_PLUGIN_TABLE_ELEMENT_LIMIT: usize = 16 * 1024;
44pub const WASM_PLUGIN_INVOCATION_FUEL: u64 = 10_000_000;
45pub const WASM_PLUGIN_HOSTCALL_FUEL: usize = 256 * 1024;
46pub const WASM_PLUGIN_EPOCH_TICK_MILLIS: u64 = 5;
47pub const WASM_PLUGIN_EVENT_TIMEOUT_MILLIS: u64 = 50;
48pub const WASM_PLUGIN_BATCH_TIMEOUT_MILLIS: u64 = 250;
49pub const WASM_PLUGIN_FLUSH_TIMEOUT_MILLIS: u64 = 2_000;
50/// Total caller wait for one queued EventHook result, including queue delay.
51pub const WASM_PLUGIN_EVENT_RESULT_WAIT_MILLIS: u64 = 250;
52/// Total caller wait for one queued BenchmarkSink batch result, including queue delay.
53pub const WASM_PLUGIN_BENCHMARK_RESULT_WAIT_MILLIS: u64 = 500;