Expand description
File Data Block Storage (Task 12)
Integrates PayloadStore as SochFS data block backend:
- O(1) append-only writes (no LSM compaction overhead)
- Transparent compression (LZ4/ZSTD based on content type)
- Block reference tracking for garbage collection
§Block Storage Architecture
┌─────────────────────────────────────────────────────────┐
│ Inode Table │
│ inode_id=7, blocks=[(off=0, len=4096, cmp=LZ4), │
│ (off=4096, len=2048, cmp=ZSTD)] │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ PayloadStore │
│ Offset 0: [LZ4 header][compressed block 1] │
│ Offset 4096: [ZSTD header][compressed block 2] │
└─────────────────────────────────────────────────────────┘§Architectural Improvements (Production Tasks)
§Task 1: Fixed-Layout BlockHeader
Uses deterministic 17-byte fixed layout with explicit little-endian encoding:
Offset Size Field Type
0 4 magic [u8; 4] = "TBLK"
4 1 compression u8
5 4 original_size u32 (LE)
9 4 compressed_size u32 (LE)
13 4 checksum u32 (LE, CRC32)
Total: 17 bytes§Task 5: Error Propagation
All serialization methods return Result<T, SochDBError> instead of
using unwrap_or_default() which silently swallows errors.
Structs§
- Block
Header - Block header in payload store (Task 1: Fixed 17-byte layout)
- Block
Ref - Block reference stored in inode
- Block
Store - File block storage backed by append-only store
- Block
Store Stats - Block store statistics
- Durable
Block Store - Durable block store with WAL-backed persistence
- Durable
Block Store Stats - Durable block store statistics
- File
Block Manager - File block manager - higher level interface for file I/O
- Recovery
Stats - Recovery statistics
- WalIterator
- Iterator over WAL records
- WalReader
- WAL reader for recovery
- WalRecord
Header - WAL record header (fixed 33-byte layout)
- WalWriter
- WAL writer for durable writes
Enums§
- Block
Compression - Compression type for blocks
- WalRecord
Type - WAL record types
Constants§
- DEFAULT_
BLOCK_ SIZE - Default block size (4KB)
- MAX_
BLOCK_ SIZE - Maximum block size (1MB)
Functions§
- is_
compressible - Check if data is likely compressible
- is_
json_ content - Check if data looks like JSON
- is_
soch_ content - Check if data looks like TOON format