Expand description
WASM Host Function ABI
This module defines the host functions that WASM plugins can call to interact with SochDB.
§Design Principles
- Capability-Checked: All operations verify permissions before execution
- Memory-Safe: All data crosses the WASM boundary via explicit serialization
- Low-Overhead: Designed for ~100ns per call overhead target
- Auditable: Every host call is logged for security auditing
§Available Host Functions
| Function | Description | Capability Required |
|---|---|---|
soch_read | Read rows from a table | can_read_table |
soch_write | Write rows to a table | can_write_table |
soch_delete | Delete rows from a table | can_write_table |
vector_search | Similarity search | can_vector_search |
index_lookup | Point/range index lookup | can_index_search |
emit_metric | Emit observability metric | (always allowed) |
log_message | Log a message | (always allowed) |
get_config | Read 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§
- Audit
Entry - Audit log entry
- Emit
Metric - Emit an observability metric
- Host
Function Context - Context passed to host function implementations
- Host
Function Registry - Registry of available host functions
- LogMessage
- Log a message
- Soch
Read - Read rows from a table
- Soch
Write - Write rows to a table
- Vector
Search - Vector similarity search
Enums§
- Host
Call Result - Result of a host function call
Traits§
- Host
Function - Trait for host function implementations