CAD-SYS // ULTSQL-KERNEL v1.0.26
COORD: X: 0000 | Y: 0000
JITTER: 0.08ms
View on pub.dev GitHub Repository
17 SIGNATURE ENGINE INNOVATIONS

Converged Engine Capabilities

ULTSQL merges relational tables, schema-less document collections, Redis-style key-value caching, and AI vector embeddings into a unified slotted-page engine written in 100% pure Dart.

Stable

Slotted-Page Storage Engine

Low-level binary slotted pages (4KB/8KB) with zero-copy row deserialization and variable-length record packing directly on disk.

// Direct vectorized slotted-page batch ingestion
final stmt = db.prepare('INSERT INTO logs VALUES (?, ?, ?);');
stmt.executeBatchSync(batchRows); // Direct binary slot packing
Stable

ARIES WAL & CRC32 Recovery

Sequential append-only Write-Ahead Log with hardware-grade CRC32 integrity checksums on every transaction block. Autonomous crash recovery on boot.

-- Automated background WAL checkpoints
SET engine_option wal_checkpoint = true;
Stable

Bottom-Up B+ Tree Construction

Bulk-sorts leaf keys to build indexes in a single cache-coherent sequential pass, achieving sub-millisecond index creation even on massive datasets.

CREATE INDEX idx_users_age ON users(age);
-- Bottom-up single-pass parent node generation
Stable

Prepared Point Lookups

Direct B+ Tree index traversal bypassing AST and parser overhead. Achieves ultra-low latency point reads on prepared statements.

final stmt = db.prepare('SELECT * FROM users WHERE id = ?;');
final res = stmt.executeSync([DbInt(42)]);
Stable

Converged NoSQL Document Store

MongoDB-style collections (`db.collection`), dotted JSON path queries, array operations, and in-place atomic mutations ($set, $inc, $push).

final users = db.collection('users');
await users.insertOne({'name': 'Alice', 'score': 95000});
final docs = await users.find({'score': {r'$gte': 80000}}).toList();
Stable

Redis-Style Key-Value Engine

High-throughput embedded Key-Value cache with hot in-memory lookups, atomic WAL persistence, TTL expiration, and atomic numeric counters.

await db.kv.set('auth:token', 'xyz', ttl: Duration(hours: 1));
final token = await db.kv.get('auth:token');
await db.kv.incr('hits:counter', 5);
Stable

Cross-Model SQL ↔ NoSQL Bridge

Query schema-less collections using standard SQL syntax with dotted path operators (`->>`), or join relational tables with document collections.

SELECT _id, doc->>'serial' AS dev_serial
FROM collection('devices')
WHERE (doc->'telemetry'->>'battery')::INT > 80;
Stable

AI Vector Search & RAG (HNSW)

Integrated Hierarchical Navigable Small World (HNSW) vector graphs. Run sub-millisecond Approximate Nearest Neighbor (ANN) search inside your database.

CREATE INDEX idx_emb ON docs(embedding) USING HNSW;
SELECT id, vector_distance(embedding, '[0.1, 0.9]') AS d
FROM docs ORDER BY d ASC LIMIT 5;
Stable

PostgreSQL Wire Protocol Server

Drop-in network database daemon implementing PostgreSQL v3.0 wire protocol on port 5432. Connect via `psql`, Python, Go, Node, or DBeaver.

final server = PgWireServer(db, port: 5432);
await server.start();
// Connect with: psql -h localhost -p 5432 -U postgres
Stable

Embedded REST Server

Built-in HTTP server daemon exposing endpoints for SQL queries, health diagnostics, and Prometheus telemetry metrics.

final rest = RestServer(db, port: 8080);
await rest.start();
// POST /api/query {"sql": "SELECT * FROM users"}
Stable

AES-256-GCM & Tamper Traps

Dual authenticated encryption envelopes with PBKDF2 key derivation. Active tamper traps abort unauthorized bit alterations on disk.

final db = Database('./secure_db', passphrase: 'master_key');
await db.init(); // Enforces authenticated cipher envelopes
Stable

Interactive CLI & REPL

Feature-rich CLI with Unicode box formatting, JSON piping, dot-commands, and interactive Mongo shell syntax execution.

# Headless CI/CD JSON query execution
ultsql app.db -m json -c "SELECT * FROM users;" | jq .
Beta

R-Tree & H3 Spatial Indexing

Geographic 2D bounding-box spatial indexing and Uber H3 hexagonal spatial binning for geospatial proximity queries.

CREATE INDEX idx_locations_geo ON venues(location) USING RTREE;
Beta

LWW CRDT State Merging

Last-Write-Wins Conflict-Free Replicated Data Types (CRDT) for multi-master offline synchronization across distributed edge nodes.

// Merge remote client state without central locking
db.mergeCrdtState(incomingRemoteStatePayload);
Experimental

Raft Consensus Clustering

Experimental distributed consensus cluster with leader election, term management, and log entry replication across networked peers.

final cluster = RaftCluster(db, peerNodes: ['10.0.0.1:5432', '10.0.0.2:5432']);
await cluster.join();

Converged Slotted-Page Architecture

How relational queries, JSON document filtering, KV caching, and vector searches funnel through a single cache-coherent engine layer.

Flutter / Dart SDK PGWire (psql/node/py) REST HTTP API Interactive CLI Relational SQL ANSI / PL-SQL / Joins NoSQL Documents db.collection Dotted JSON Key-Value Engine db.kv Hot RAM Cache AI Vector Search HNSW Graph RAG Unified Storage Engine Core 4KB/8KB Slotted Pages • ARIES Write-Ahead Log (WAL) • CRC32 Checksums • AES-256 Envelopes Durable NVMe Disk Storage / Fast In-Memory RAM

Architectural Capability Matrix

Factual operational comparison of database capabilities across models.

Feature Capability ULTSQL SQLite MongoDB Redis Postgres + pgvector
Pure Dart (Zero C Dependencies) ✓ Yes (100%) ✗ C FFI ✗ C++ ✗ C ✗ C
Embedded In-Process File Engine ✓ Yes ✓ Yes ✗ Daemon Only ✗ Daemon Only ✗ Daemon Only
Relational SQL & ACID Transactions ✓ Full ACID ✓ Full ACID ✗ Multi-doc Limited ✗ Redis Tx ✓ Full ACID
Native NoSQL Document API ✓ Native db.collection ✗ JSON1 Extension ✓ Native ✗ RedisJSON ✗ JSONB SQL
Redis-Style KV Engine (TTL & Counters) ✓ Native db.kv ✗ Manual Table ✗ No ✓ Native ✗ UNLOGGED table
Native AI Vector Graph Search (HNSW) ✓ Built-in HNSW ✗ Requires sqlite-vec ✗ Atlas Cloud Only ✗ RedisSearch ✓ pgvector extension
PostgreSQL Wire Protocol Server ✓ Embedded daemon ✗ No ✗ No ✗ RESP protocol ✓ Native
WebAssembly (WASM) & Browser Ingest ✓ Full in-browser ✓ via Emscripten ✗ No ✗ No ✗ No
ESC
✓ Copied