Initial commit: SRDB - High-performance LSM-Tree database

- Core engine with MemTable, SST, WAL
- B+Tree indexing for SST files  
- Leveled compaction strategy
- Multi-table database management
- Schema validation and secondary indexes
- Query builder with complex conditions
- Web UI with HTMX for data visualization
- Command-line tools for diagnostics
This commit is contained in:
2025-10-08 06:38:12 +08:00
commit ae87c38776
61 changed files with 15475 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
package manifest
import (
"io"
"sync"
)
// Writer MANIFEST 写入器
type Writer struct {
file io.Writer
mu sync.Mutex
}
// NewWriter 创建 MANIFEST 写入器
func NewWriter(file io.Writer) *Writer {
return &Writer{
file: file,
}
}
// WriteEdit 写入版本变更
func (w *Writer) WriteEdit(edit *VersionEdit) error {
w.mu.Lock()
defer w.mu.Unlock()
// 编码
data, err := edit.Encode()
if err != nil {
return err
}
// 写入
_, err = w.file.Write(data)
return err
}