How miraj0/oj_x works
oj_x Database Engine is a memory-mapped chunk store exposed through a single HTTP endpoint. A client submits an operation type; the endpoint dispatches insert, delete, raw-read, chain-read, or integer-insert requests to the database engine and returns the result. The engine initializes mapped storage and a free-index list, allocates chunks as needed, and persists changes asynchronously. The README documents these capabilities; the sampled source confirms the endpoint and storage calls.
Main entry points: main.cpp Ask endpoint · data.bin Mapped data file · database.cpp Block allocator · server_context.h Server context
Components 12
HTTP API
- Ask endpoint
server/all_routes/main.cpp
Database Engine
- DB initialization
server/data_base/database.cpp - Block allocator
server/data_base/database.cpp - Payload insert
server/data_base/database.cpp - Chunk delete
server/data_base/database.cpp - Raw chunk read
server/data_base/database.cpp - Chain read
server/data_base/database.cpp - Integer insert
server/data_base/database.cpp - Server context
server/data_base/server_context.h
Persistent Storage
- Mapped data file
server/data_base/data.bin - Free-index file
server/data_base/free_index.bin
Other components
- API client
Connections 22
- API client → Ask endpoint: sends request
- Ask endpoint → DB initialization: initializes at startup
- Ask endpoint → Payload insert: dispatches type 1
- Ask endpoint → Chunk delete: dispatches type 2
- Ask endpoint → Raw chunk read: dispatches type 3
- Ask endpoint → Chain read: dispatches type 4
- Ask endpoint → Integer insert: dispatches type 5
- DB initialization → Server context: initializes
- DB initialization → Mapped data file: maps
- DB initialization → Free-index file: loads indices
- Payload insert → Block allocator: allocates blocks
- Integer insert → Block allocator: allocates head
- Block allocator → Server context: uses free list
- Block allocator → Mapped data file: expands mapping
- Block allocator → Free-index file: updates indices
- Payload insert → Mapped data file: writes payload
- Chunk delete → Mapped data file: follows chunk links
- Chunk delete → Server context: recycles indices
- Chunk delete → Free-index file: appends indices
- Raw chunk read → Mapped data file: reads chunk
- Chain read → Mapped data file: reads linked chunks
- Integer insert → Mapped data file: writes integer