v0.6.0

Data Layout

Last updated


Where KuraDB keeps its files on disk and the structure of each database's SQLite table.

Directory Tree


  1. ~/.config/kuradb/
  2. ├── db.json registry: [{"db": "<name>", "createAt": "<RFC 3339 UTC>"}]
  3. ├── config.json port and remote settings
  4. ├── endpoint daemon URL, present while the HTTP server runs
  5. ├── runtime.uid {"uid", "pid", "started_at"} of the running daemon
  6. ├── daemon.log daemon output, appended
  7. └── <name>/
  8. ├── inbox/ watched folder; drop files here
  9. ├── data.db SQLite database (WAL mode, plus -wal and -shm files)
  10. └── record.json watcher snapshot of the inbox tree
  11. ~/Kura_<name> symlink to ~/.config/kuradb/<name>/inbox

~/Kura_<name> is recreated on every daemon start if it is missing or points elsewhere; if a non-symlink file sits at that path, the database is skipped with a warning.

file_data Table


Every database has one table, created by internal/database/schema/file_data.sql:
ColumnTypeMeaning
idINTEGER PRIMARY KEYRow id; second ranking key in search
sourceTEXT NOT NULLAbsolute file path inside the inbox
chunkINTEGER NOT NULL1-based chunk number within the file
totalINTEGER NOT NULLChunk count of the file at write time
contentTEXT NOT NULLChunk text
dismissBOOLEAN NOT NULL DEFAULT FALSETRUE once the chunk was replaced or its file removed
created_at, updated_atTIMESTAMPSet to CURRENT_TIMESTAMP on insert and update

(source, chunk) is unique, and idx_file_data_source indexes source.

SQLite Connections


Each data.db is opened through go-sqlkit with one write connection and a read pool of 8. Both use WAL journaling and a 50-second busy timeout; the read pool opens the file read-only. This lets a kura mcp process read while the daemon writes.

中文