Skip to main content

Crate sochdb_kernel

Crate sochdb_kernel 

Source
Expand description

§SochDB Kernel

The minimal ACID core of SochDB with a plugin architecture.

§Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Extension Layer                          │
│  ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐   │
│  │ LSCS Plugin │ │Vector Plugin│ │ Observability Plugin│   │
│  └──────┬──────┘ └──────┬──────┘ └──────────┬──────────┘   │
│         │               │                    │              │
│         ▼               ▼                    ▼              │
│  ┌─────────────────────────────────────────────────────┐   │
│  │              Plugin Manager (Registry)               │   │
│  └─────────────────────────┬───────────────────────────┘   │
└────────────────────────────┼────────────────────────────────┘
                             │
┌────────────────────────────┼────────────────────────────────┐
│                            ▼                                │
│  ┌─────────────────────────────────────────────────────┐   │
│  │                 Kernel API (Traits)                  │   │
│  │   KernelStorage, KernelTransaction, KernelCatalog    │   │
│  └─────────────────────────────────────────────────────┘   │
│                                                             │
│  ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐   │
│  │   WAL    │ │   MVCC   │ │  Pager   │ │   Catalog    │   │
│  │ Recovery │ │   Txn    │ │  Buffer  │ │   Schema     │   │
│  └──────────┘ └──────────┘ └──────────┘ └──────────────┘   │
│                                                             │
│                     KERNEL (~5K LOC)                        │
│              Auditable • Stable API • ACID                  │
└─────────────────────────────────────────────────────────────┘

§Design Principles

  1. Minimal Core: Only ACID-critical code in kernel (<5K LOC)
  2. Plugin Everything: Storage backends, indices, observability are plugins
  3. No Dependency Bloat: Core has minimal deps, plugins bring their own
  4. Stable API: Kernel API is versioned, plugins can evolve independently
  5. Auditable: Small enough for formal verification

§WASM Plugin System

The kernel supports secure WASM-sandboxed plugins with:

  • Memory isolation (linear memory per plugin)
  • Fuel limits (instruction counting)
  • Capability-based access control
  • Hot-reload without restart

Re-exports§

pub use error::KernelError;
pub use error::KernelResult;
pub use kernel_api::KernelCatalog;
pub use kernel_api::KernelStorage;
pub use kernel_api::KernelTransaction;
pub use plugin::Extension;
pub use plugin::ExtensionCapability;
pub use plugin::ExtensionInfo;
pub use plugin::IndexExtension;
pub use plugin::ObservabilityExtension;
pub use plugin::PluginManager;
pub use plugin::StorageExtension;
pub use transaction::IsolationLevel;
pub use transaction::TransactionId;
pub use transaction::TransactionState;
pub use transaction::TxnManager;
pub use wal::LogSequenceNumber;
pub use wal::WalManager;
pub use wal::WalRecord;
pub use wal::WalRecordType;
pub use boot_fsm::BootBudgets;
pub use boot_fsm::BootError;
pub use boot_fsm::BootMetrics;
pub use boot_fsm::BootOrchestrator;
pub use boot_fsm::BootPhase;
pub use boot_fsm::BootStateMachine;
pub use boot_fsm::HealthStatus;
pub use boot_fsm::PhaseProgress;
pub use boot_fsm::PreloadHints;
pub use boot_fsm::RecoveryMode;
pub use atomic_claim::AtomicClaimManager;
pub use atomic_claim::ClaimResult;
pub use atomic_claim::ClaimStats;
pub use atomic_claim::ClaimToken;
pub use atomic_claim::CompareAndSwap;
pub use atomic_claim::LeaseConfig;
pub use atomic_claim::LeaseManager;

Modules§

atomic_claim
Atomic Claim Protocol for Queue Operations
boot_fsm
Deterministic Boot Finite State Machine
error
Kernel error types
kernel_api
Kernel API Traits
page
Page Management
plugin
Plugin Architecture
plugin_hot_reload
Hot-Reload Without Restart
plugin_manifest
Plugin Manifest Schema
python_sandbox
Modern Python Plugin Runtime
transaction
Transaction Management
wal
Write-Ahead Logging (WAL)
wasm_host_abi
WASM Host Function ABI
wasm_runtime
WASM-Sandboxed Multi-Tenant Plugin Runtime
wasm_sandbox_runtime
WASM-Sandbox Crate Integration (Task 10)

Constants§

KERNEL_API_VERSION
Kernel API version - bump when breaking changes occur
KERNEL_VERSION
Kernel version for API stability tracking
MAX_KERNEL_LOC
Maximum recommended kernel code size for auditability