overdrive-db 0.2.0

Hybrid SQL+NoSQL database with Git-like versioning
Documentation
overdrive-db-0.2.0 has been yanked.

⚡ OverDrive-DB Professional Edition

Ultra-fast, hybrid SQL+NoSQL database with Git-like versioning, ACID transactions, and tamper-proof security.

Rust License Edition ACID SQL


🚀 Why OverDrive-DB?

OverDrive-DB is a high-performance database engine built in pure Rust — combining the reliability of structured SQL, the speed of NoSQL JSON storage, and the safety of Git-like version control in one engine.

âœĻ Core Pillars

Feature Description
💎 Hybrid Model SQL queries + flexible NoSQL JSON storage
🔄 ACID Transactions BEGIN/COMMIT/ROLLBACK/SAVEPOINT with 4 isolation levels
🌀 Git-like Versioning Every change is a commit — rollback any table to any point
ðŸ›Ąïļ Tamper-Proof SHA-256 hash chains + CRC32 checksums on every page
🏎ïļ Sub-Millisecond Memory-mapped storage with zero-copy reads
🔒 Enterprise Security TLS 1.3, Argon2id auth, RBAC enforcement
📇 Secondary Indexes BTree, Hash, and Unique indexes for fast lookups
🔗 Referential Integrity Foreign keys, unique constraints, NOT NULL checks

ðŸ“Ķ Quick Start

# 1. Initialize
overdrive-admin init --data-dir ./data --force

# 2. Set Credentials
$env:OVERDRIVE_ADMIN_USER = "admin"
$env:OVERDRIVE_ADMIN_PASS = "secure_password_123"

# 3. Start Server
overdrive-serve --data-dir ./data

# 4. Connect
overdrive -h 127.0.0.1 -p 6969 -u admin -w secure_password_123 --insecure

🛠ïļ SQL Command Reference

DDL — Data Definition Language

CREATE DATABASE mydb;
USE mydb;
DROP DATABASE mydb;
SHOW DATABASES;

CREATE TABLE users;
DROP TABLE users;
SHOW TABLES;
DESCRIBE users;                        -- Schema + row count

-- Schema Evolution
ALTER TABLE users ADD COLUMN email;
ALTER TABLE users ADD COLUMN status DEFAULT 'active';
ALTER TABLE users DROP COLUMN temp_field;
ALTER TABLE users RENAME COLUMN old_name TO new_name;

Indexes

CREATE INDEX idx_email ON users (email);
CREATE UNIQUE INDEX idx_username ON users (username);
CREATE HASH INDEX idx_status ON users (status);
DROP INDEX idx_email;
SHOW INDEXES ON users;

Constraints

ADD CONSTRAINT uq_email UNIQUE (users.email);
ADD CONSTRAINT fk_order_user FOREIGN KEY (orders.user_id) REFERENCES (users._id);
DROP CONSTRAINT uq_email;
SHOW CONSTRAINTS ON users;

DML — Data Manipulation Language

-- Insert
INSERT INTO users {"name": "Karthik", "age": 25, "role": "admin"}

-- Select
SELECT * FROM users;
SELECT name, age FROM users WHERE age > 21 ORDER BY name ASC LIMIT 10;
SELECT DISTINCT role FROM users;

-- Aggregation + GROUP BY
SELECT COUNT(*) FROM users;
SELECT AVG(age) FROM users;
SELECT SUM(salary) FROM employees WHERE dept = 'engineering';
SELECT MIN(age) FROM users;
SELECT MAX(salary) FROM employees;
SELECT COUNT(*) FROM orders GROUP BY status;

-- JOINs
SELECT * FROM orders INNER JOIN users ON orders.user_id = users._id;
SELECT * FROM orders LEFT JOIN users ON orders.user_id = users._id;
SELECT * FROM orders RIGHT JOIN users ON orders.user_id = users._id;

-- Update & Delete
UPDATE users SET {"role": "admin"} WHERE name = 'Karthik';
DELETE FROM users WHERE age < 18;

-- Full-Text Search
SEARCH 'Karthik';

WHERE Operators

Operator Example
= WHERE name = 'Karthik'
!= / <> WHERE status != 'inactive'
> < >= <= WHERE age > 21
LIKE WHERE name LIKE '%arth%'
AND WHERE age > 21 AND role = 'admin'
OR WHERE dept = 'eng' OR dept = 'ops'

DCL — Data Control Language

CREATE USER analyst WITH PASSWORD 'p@ss123' ROLE readonly;
DROP USER analyst;
GRANT admin TO analyst;
REVOKE admin FROM analyst;
SHOW USERS;

TCL — Transaction Control Language

BEGIN;                                -- Read Committed (default)
BEGIN ISOLATION SERIALIZABLE;         -- Specific isolation level
SAVEPOINT checkpoint1;                -- Named savepoint
ROLLBACK TO checkpoint1;              -- Revert to savepoint
COMMIT;                               -- Persist changes
ROLLBACK;                             -- Abort transaction

Isolation Levels: READ UNCOMMITTED, READ COMMITTED, REPEATABLE READ, SERIALIZABLE

Utility Commands

EXPLAIN SELECT * FROM users WHERE age > 21;  -- Query plan
HISTORY;                                      -- Commit history
VERIFY;                                       -- Integrity check

🏭 Production Operations

-- Monitoring
SHOW STATUS;                                  -- Prometheus-style metrics
SHOW HEALTH;                                  -- Health check (status, uptime, error rate)
SHOW SLOW QUERIES;                            -- Slow query log (top 10)

-- Backup & Recovery
BACKUP DATABASE;                              -- Full compressed backup to ./backups/
CHECK DATABASE;                               -- Page validation + hash chain verification

-- Cache Management
SHOW CACHE;                                   -- Cache hit/miss statistics
FLUSH CACHE;                                  -- Clear query cache

-- Server Control
SHUTDOWN;                                     -- Graceful shutdown (flush WAL → close connections)

🏗ïļ Architecture

Storage Engine

B+Tree with internal node splitting, size-aware page rebalancing, and Copy-on-Write (CoW). Branch nodes enable O(log n) lookups across multi-level trees. Tombstone-based deletion defers physical removal for consistency.

MVCC — Multi-Version Concurrency Control

The programmatic API exposes full transactional control:

use overdrive_db::storage::database::Database;
use overdrive_db::storage::mvcc::IsolationLevel;

let mut db = Database::create("mydb.odb")?;

// Transactional writes
let txn = db.begin_transaction(IsolationLevel::Serializable)?;
let id = db.insert_mvcc(txn.id, "users", &json!({"name": "Karthik"}))?;
db.commit_transaction(txn.id)?;

// Transactional reads (snapshot isolation)
let txn2 = db.begin_transaction(IsolationLevel::RepeatableRead)?;
let record = db.get_mvcc(txn2.id, "users", &id)?;

// Garbage collect old versions
db.gc_old_versions(min_active_timestamp);

Secondary Indexes API

use overdrive_db::storage::index::{IndexDef, IndexType};

db.create_index(IndexDef {
    name: "idx_email".into(),
    table: "users".into(),
    columns: vec!["email".into()],
    index_type: IndexType::BTree,
    unique: true,
})?;

let results = db.query_by_index("idx_email", "\"alice@example.com\"")?;
db.drop_index("idx_email");

Indexes are automatically updated on insert_json, update, and delete.

Concurrency Control

Feature Implementation
Row/Table Locking Shared, Exclusive, Intent modes
Deadlock Detection BFS on wait-for graph
Lock Timeouts Configurable per-session
WAL Disk-persisted, checksummed entries
Undo Log Per-transaction rollback support
MVCC Versioned reads with snapshot isolation

Security Stack

Layer Technology
Transport TLS 1.3 (auto-generated certs)
Authentication Argon2id memory-hard hashing
Authorization RBAC with GRANT/REVOKE
Data Integrity SHA-256 hash chains + CRC32
Sessions Token binding + TLS pinning

Query Engine

Component Capabilities
JoinExecutor INNER, LEFT, RIGHT JOIN
Aggregator COUNT, SUM, AVG, MIN, MAX + GROUP BY
Sorter Multi-column ORDER BY with ASC/DESC
IndexManager BTree, Hash, Unique index types
ConstraintManager Unique, FK, NOT NULL, Check constraints
Optimizer Cost-based with table statistics

⚡ SIMD Vectorization

use overdrive_db::utils::simd::{SimdScanner, CmpOp};

// Batch filter: find all values > 100
let indices = SimdScanner::filter_i64(&data, 100, CmpOp::Gt);

// Vectorized aggregation
let total = SimdScanner::sum_i64(&data);
let (min, max) = SimdScanner::min_max_i64(&data).unwrap();

// Fast byte-pattern search (word-at-a-time)
let pos = SimdScanner::contains_bytes(haystack, b"needle");

🔄 Async I/O

use overdrive_db::io::async_io::{AsyncIoManager, AsyncPageReader};

let mut mgr = AsyncIoManager::new("mydb.odb", 4)?; // 4 worker threads

// Submit async page reads
let mut reader = AsyncPageReader::new();
reader.submit_reads(&mut mgr, &[0, 1, 2, 3]);
let pages = reader.collect_all(&mgr); // Wait for completion

// Check I/O stats
let stats = mgr.stats();
println!("Reads: {}, Writes: {}", stats.reads_completed, stats.writes_completed);

mgr.shutdown();

📈 Performance

Action Throughput
Reads (Mmap) 200,000+ ops/sec
Writes (WAL) 80,000+ ops/sec
Rollback O(1) instant
Indexed Lookup O(log n)
JOIN (1K×1K) <10ms
SIMD Filter (10K) <100Ξs

📚 Resources


Built with âĪïļ in Rust ðŸĶ€ Professional Edition v0.2.0