OVERVIEW
Monorepo/Flagship Apps/apps/kv (kaledis)
v0.1.0 • ActiveSource Code
apps/kv/

apps/kv (kaledis)

In-Memory Key-Value Store & Redis Daemon

A high-performance in-memory key-value database engine and TCP network daemon for Kale. Implements Redis RESP serialization (strings, integers, arrays, errors), hash map storage with collision handling, slot compaction, and CLI command dispatching.

ProtocolRedis RESP / TCP
Storage EngineIn-Memory Hash Map
CommandsPING, SET, GET, DEL, KEYS
MilestoneActive Module
apps/kv (kaledis)
Frame Budget & Event Loop
Target: 144 FPS (6.94ms per frame)
1. Input Polling (0.2ms)
Raw keyboard & mouse events polled via GLFW3 callbacks
2. Piece Table Mutation (0.4ms)
Append-only buffer edit with instant O(1) undo/redo stack
3. GPU Batched Quad Draw (0.8ms)
Dynamic font atlas textures rendered in single GPU draw call
Graphics Engine Architecture
Piece Table Buffer Engine

Sub-Millisecond Multi-Cursor Editing

Unlike line-array or gap-buffer architectures, the Kale Piece Table holds an immutable original file buffer coupled with an append-only edit buffer. Loading a 100MB file takes under 1ms because no memory copying occurs.

Buffer Type: Immutable File Span + Append-Only Log
Undo/Redo: Zero heap copy • O(1) pointer adjustment
kv_main.kl
kale
import "apps/kv/store.kl" as kv;
import "apps/kv/daemon.kl" as daemon;

fn main() -> int32 {
    let store: kv.KvStore* = kv.store_new(256);
    kv.store_set(store, "system_name", "Kale Ecosystem");
    kv.store_set(store, "version", "v0.2.0");

    let val: string = kv.store_get(store, "system_name");
    print(val);
    kv.store_free(store);
    return 0;
}
Compilation & Linker Directives

Deterministic command-line invocations to build, link native dynamic dependencies, and run automated regression tests:

$kale build apps/kv/main.kl -o bin/kaledis.exe -lws2_32
$./bin/kaledis.exe --port 6379
$redis-cli -p 6379 PING
Monorepo Governance

GPG Key 1B917D4779A6102E • Continuous integration with automated symbol verification.

Architectural Capabilities
RESP Serialization

Full wire-level parser and serializer for Redis Simple Strings, Bulk Strings, Integers, and Arrays.

High-Throughput Daemon

Powered by libs/net/tcp for concurrent network I/O and zero-allocation query handling.

In-Memory Hash Map

Deterministic bucket hashing with dynamic capacity tracking, slot reuse, and key enumeration.