重构:简化 RecordIndex 结构体

删除独立的 IndexHeader 结构体,将 magic 和 version 字段直接放入 RecordIndex,减少不必要的嵌套层级。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-03 23:55:18 +08:00
parent de39339620
commit a421ca1d85
2 changed files with 14 additions and 21 deletions

View File

@@ -272,12 +272,12 @@ func TestIndexHeader(t *testing.T) {
writer.Close()
// 验证魔数和版本
if index.header.Magic != IndexMagic {
t.Errorf("Magic 不正确: got 0x%X, want 0x%X", index.header.Magic, IndexMagic)
if index.magic != IndexMagic {
t.Errorf("Magic 不正确: got 0x%X, want 0x%X", index.magic, IndexMagic)
}
if index.header.Version != IndexVersion {
t.Errorf("Version 不正确: got %d, want %d", index.header.Version, IndexVersion)
if index.version != IndexVersion {
t.Errorf("Version 不正确: got %d, want %d", index.version, IndexVersion)
}
// 验证记录总数(从内存索引计算)