重构:优化记录格式并修复核心功能

- 修改记录存储格式为 [4B len][8B offset][4B CRC][16B UUID][data]
- 修复 TopicProcessor 中 WaitGroup 使用错误导致 handler 不执行的问题
- 修复写入保护逻辑,避免 dirtyOffset=-1 时误判为写入中
- 添加统计信息定期持久化功能
- 改进 UTF-8 字符截断处理,防止 CJK 字符乱码
- 优化 Web UI:显示人类可读的文件大小,支持点击外部关闭弹窗
- 重构示例代码,添加 webui 和 webui_integration 示例

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-04 17:54:49 +08:00
parent 955a467248
commit 810664eb12
18 changed files with 1810 additions and 1170 deletions

View File

@@ -72,8 +72,7 @@ import "github.com/google/uuid"
// Record 日志记录
//
// 存储格式:[4B len][4B CRC][16B UUID][data]
// 注意Offset 不存储在数据文件中,而是由索引文件管理
// 存储格式:[4B len][8B offset][4B CRC][16B UUID][data]
type Record struct {
Len uint32 // 数据长度
CRC uint32 // CRC 校验和