|
|
810664eb12
|
重构:优化记录格式并修复核心功能
- 修改记录存储格式为 [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>
|
2025-10-04 17:54:49 +08:00 |
|
|
|
90cc9e21c9
|
重构:重命名核心组件并增强查询功能
主要更改:
1. 核心重命名
- Seqlog -> LogHub (更准确地反映其作为日志中枢的角色)
- NewSeqlog() -> NewLogHub()
- LogCursor -> ProcessCursor (更准确地反映其用于处理场景)
- seqlog_manager.go -> loghub.go (文件名与结构体名对应)
2. TopicProcessor.Reset 增强
- 如果正在运行且没有待处理的日志,会自动停止后重置
- 如果有待处理的日志,返回详细错误(显示已处理/总记录数)
- 简化了 LogHub.ResetTopic,移除显式 Stop 调用
3. 新增查询方法
- TopicProcessor.QueryFromFirst(count) - 从第一条记录向索引递增方向查询
- TopicProcessor.QueryFromLast(count) - 从最后一条记录向索引递减方向查询
- LogHub.QueryFromFirst(topic, count)
- LogHub.QueryFromLast(topic, count)
4. 测试覆盖
- 添加 query_test.go - QueryFromProcessing 测试
- 添加 TestQueryFromFirstAndLast - TopicProcessor 查询测试
- 添加 TestLogHubQueryFromFirstAndLast - LogHub 查询测试
- 添加 TestTopicResetWithPendingRecords - Reset 增强功能测试
5. 示例代码
- 添加 example/get_record/ - 演示 QueryFromProcessing 用法
- 更新所有示例以使用 LogHub 和新 API
所有测试通过 ✅
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-04 13:26:21 +08:00 |
|
|
|
dfdc27c67f
|
修复:统一查询方法的返回顺序为索引递增
重要变更:
- QueryOldest 和 QueryNewest 现在都返回按索引递增排序的结果
- 移除了 QueryNewest 中的结果反转操作(line 184-187)
方法行为说明:
- QueryOldest(startIndex, count): 从 startIndex 向索引递增方向查询
- QueryNewest(endIndex, count): 从 endIndex 向索引递减方向查询
- 两者返回结果都按索引递增方向排序(一致性)
更新内容:
1. query.go:
- 移除 QueryNewest 的反转操作
- 更新两个方法的注释
2. topic_processor.go: 更新注释与实现一致
3. seqlog_test.go: 更新测试预期结果
4. example/index/main.go: 更新注释和输出说明
测试验证:
- 所有测试通过(go test ./... -short)
- 示例编译成功
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-04 11:55:44 +08:00 |
|
|
|
3d82a6845e
|
重构:将示例文件组织到子目录
修复 Go 规范问题:一个目录不能有多个 package main
文件结构调整:
- example/concurrent_example.go → example/concurrent/main.go
- example/index_example.go → example/index/main.go
- example/topic_processor_example.go → example/topic_processor/main.go
修复 API 适配:
- index/main.go: 更新为新的查询 API(移除 startIdx/endIdx 参数)
- webapp/main.go: 使用 processor.Query 方法替代 RecordQuery
- 移除 queryCache,直接使用 processor
- 更新查询调用,移除状态参数
文档更新:
- example/README.md: 更新所有示例的运行路径
- example/RUN_CONCURRENT.md: 更新运行命令
所有示例编译测试通过 ✅
|
2025-10-04 01:27:56 +08:00 |
|