feat: introduce global meta store and root store concept, and update CLI to manage active store
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
# Storage Format
|
||||
|
||||
## Directory Layout
|
||||
|
||||
```
|
||||
~/.local/share/lattice/
|
||||
├── identity.key # Ed25519 private key (not replicated)
|
||||
├── meta.db # Global metadata (redb)
|
||||
└── stores/{uuid}/
|
||||
├── logs/{author}.log # Append-only SignedEntry stream
|
||||
└── state.db # Per-store KV state (redb)
|
||||
```
|
||||
|
||||
## meta.db (redb)
|
||||
|
||||
| Table | Key | Value | Purpose |
|
||||
|---------|---------------|--------------------|------------------------------|
|
||||
| stores | UUID (16B) | created_at (u64) | Known stores |
|
||||
| meta | "root_store" | UUID (16B) | Auto-opened on CLI startup |
|
||||
|
||||
## state.db (redb, per store)
|
||||
|
||||
| Table | Key | Value | Purpose |
|
||||
|---------|----------|-------------|------------------------|
|
||||
| kv | String | Vec<u8> | Key-value data |
|
||||
| meta | String | Vec<u8> | last_seq, last_hash |
|
||||
|
||||
## Log Files
|
||||
|
||||
Each `{author}.log` contains length-delimited `LogRecord` messages:
|
||||
|
||||
```protobuf
|
||||
message LogRecord {
|
||||
bytes hash = 1; // BLAKE3 hash of entry_bytes
|
||||
bytes entry_bytes = 2; // Serialized SignedEntry
|
||||
}
|
||||
```
|
||||
|
||||
Hashes are verified on read; corruption causes `LogError::HashMismatch`.
|
||||
Reference in New Issue
Block a user