Skip to content

Instantly share code, notes, and snippets.

@kyessenov
Created March 23, 2023 19:39
Show Gist options
  • Save kyessenov/89898dc767c05b40f17668676563b38b to your computer and use it in GitHub Desktop.
Save kyessenov/89898dc767c05b40f17668676563b38b to your computer and use it in GitHub Desktop.
Wasm ABI surface
* Logging:
extern "C" WasmResult proxy_log(LogLevel level, const char *logMessage, size_t messageSize);
extern "C" WasmResult proxy_get_log_level(LogLevel *level);
* Timers:
extern "C" WasmResult proxy_set_tick_period_milliseconds(uint32_t millisecond);
* Attribute accessors:
extern "C" WasmResult proxy_get_property(const char *path_ptr, size_t path_size,
* Attribute setters:
extern "C" WasmResult proxy_set_property(const char *path_ptr, size_t path_size,
* Shared data:
extern "C" WasmResult proxy_get_shared_data(const char *key_ptr, size_t key_size,
extern "C" WasmResult proxy_set_shared_data(const char *key_ptr, size_t key_size,
* Shared queues:
extern "C" WasmResult proxy_register_shared_queue(const char *queue_name_ptr,
extern "C" WasmResult proxy_resolve_shared_queue(const char *vm_id, size_t vm_id_size,
extern "C" WasmResult proxy_dequeue_shared_queue(uint32_t token, const char **data_ptr,
extern "C" WasmResult proxy_enqueue_shared_queue(uint32_t token, const char *data_ptr,
* Raw buffer access: what type of buffer?
extern "C" WasmResult proxy_get_buffer_bytes(WasmBufferType type, uint32_t start, uint32_t length,
extern "C" WasmResult proxy_get_buffer_status(WasmBufferType type, size_t *length_ptr,
extern "C" WasmResult proxy_set_buffer_bytes(WasmBufferType type, uint32_t start, uint32_t length,
* Remote HTTP call
extern "C" WasmResult proxy_http_call(const char *uri_ptr, size_t uri_size, void *header_pairs_ptr,
* Remote gRPC call
extern "C" WasmResult proxy_grpc_call(const char *service_ptr, size_t service_size,
extern "C" WasmResult proxy_grpc_stream(const char *service_ptr, size_t service_size,
extern "C" WasmResult proxy_grpc_cancel(uint32_t token);
extern "C" WasmResult proxy_grpc_close(uint32_t token);
extern "C" WasmResult proxy_grpc_send(uint32_t token, const char *message_ptr, size_t message_size,
* Metrics:
extern "C" WasmResult proxy_define_metric(MetricType type, const char *name_ptr, size_t name_size,
extern "C" WasmResult proxy_increment_metric(uint32_t metric_id, int64_t offset);
extern "C" WasmResult proxy_record_metric(uint32_t metric_id, uint64_t value);
extern "C" WasmResult proxy_get_metric(uint32_t metric_id, uint64_t *result);
* Foreign functions:
extern "C" WasmResult proxy_call_foreign_function(const char *function_name,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment