॥ प्रायोगिक-कार्याणि ॥

Building High-Grade Databases

Learn to engineer zero-latency, highly concurrent ACID databases from scratch using Sassembly and Sanskriti.

TIER 4 · PRACTICAL ENGINEERING
सिद्धांत (Theory & Architecture)

Database Architecture in SanOS

Building a database engine (like PostgreSQL or Redis) typically requires millions of lines of C++. In the ParamTatva ecosystem, building a highly performant, ACID-compliant database is achieved natively through the SanOS Storage Subsystem and the Vyāpti (व्याप्ति - Memory Extent) concept.

Instead of manually managing page caches and dirty memory blocks, Sassembly treats the database file as an immense, memory-mapped entity directly accessible via atomic operations (परमाणवः).

[ Client Request ] → (Network Port 5432)

[ Kāraka Dispatcher ] → (Concurrent Reader/Writer Pool)

[ Vyāpti Tree (B-Tree) ] ↔ (Atomic Hardware Registers)

[ SanOS Storage Layer ]

Core Concepts

  • ACID Compliance: Achieved entirely through hardware-enforced यम् (Atomic Lock) instructions natively built into the syntax.
  • B-Tree Indexing: Trees are constructed using literal recursive pointers, validated formally by the Sassembly semantic parser.
प्रारूप (Specifications)

Translating DB Requirements to Sanskriti

To build a Key-Value store, we first write out the explicit specifications in English, and then provide the deterministic Sanskrit counterpart to the Sassembly compiler.

English Specification

"Create a secure, persistent Key-Value database store named 'tatvabase'. Allocate 2 Gigabytes of memory-mapped storage. Listen on port 6000 for concurrent read and write requests. Enforce atomic locks on write operations."

Sanskrit Counterpart (Sanskriti Input)

॰ TatvaBase - A 2GB Concurrent KV Store
कोशः 'tatvabase' इति नाम्ना सृज ।
तस्य व्याप्तिः द्विगिगाबाइट्-प्रमाणेन स्थापय ।
षट्सहस्र-द्वारे (Port 6000) युगपत्-पठन-लेखन-अनुरोधान् शृणु ।
लेखन-काले परमाणवीय-यम् (Atomic Lock) प्रयोजय ।
प्रक्रिया (CLI Tutorial)

Building with the Sanskriti CLI

With your Sanskrit specification saved in a file named database.सस, compiling this into a production-ready database engine is done via the sanskriti build command.

  1. Compile the Database:
    $ sanskriti build database.सस --target sanos-64
    [संस्कृति] Parsing AST for 'database.सस'...
    [संस्कृति] Allocating 2GB Virtual Vyāpti...
    [संस्कृति] Compiling Atomic Lock Routines...
    [संस्कृति] Successfully built: tatvabase.exe
  2. Run the Engine:
    $ ./tatvabase.exe
    [TatvaBase] System Initialized.
    [TatvaBase] Atomic Memory Pool: 2GB (Mapped).
    [TatvaBase] Listening on Port 6000...