Skip to main content

Module wasm_host_abi

Module wasm_host_abi 

Source
Expand description

WASM Host Function ABI

This module defines the host functions that WASM plugins can call to interact with SochDB.

§Design Principles

  1. Capability-Checked: All operations verify permissions before execution
  2. Memory-Safe: All data crosses the WASM boundary via explicit serialization
  3. Low-Overhead: Designed for ~100ns per call overhead target
  4. Auditable: Every host call is logged for security auditing

§Available Host Functions

FunctionDescriptionCapability Required
soch_readRead rows from a tablecan_read_table
soch_writeWrite rows to a tablecan_write_table
soch_deleteDelete rows from a tablecan_write_table
vector_searchSimilarity searchcan_vector_search
index_lookupPoint/range index lookupcan_index_search
emit_metricEmit observability metric(always allowed)
log_messageLog a message(always allowed)
get_configRead plugin config(always allowed)

§Memory Model

┌─────────────────────────────────────────────────────┐
│                  WASM Linear Memory                  │
│  ┌─────────────────────────────────────────────┐    │
│  │         Plugin Code & Data                   │    │
│  └─────────────────────────────────────────────┘    │
│  ┌─────────────────────────────────────────────┐    │
│  │     Input Buffer (host writes here)         │    │
│  └─────────────────────────────────────────────┘    │
│  ┌─────────────────────────────────────────────┐    │
│  │     Output Buffer (plugin writes here)       │    │
│  └─────────────────────────────────────────────┘    │
└─────────────────────────────────────────────────────┘

Modules§

wire
Serialization helpers for crossing WASM boundary

Structs§

AuditEntry
Audit log entry
EmitMetric
Emit an observability metric
HostFunctionContext
Context passed to host function implementations
HostFunctionRegistry
Registry of available host functions
LogMessage
Log a message
SochRead
Read rows from a table
SochWrite
Write rows to a table
VectorSearch
Vector similarity search

Enums§

HostCallResult
Result of a host function call

Traits§

HostFunction
Trait for host function implementations