Repository navigation
feat: custom database routing, bounded batches and data maintenance - #43
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
自备 IPv4/IPv6 数据库现在可以由同一个原生客户端显式路由;外部异步来源的批量查询可以指定并发上限;内置数据提供独立的暂存、校验和应用工具。三项功能分别提交,保留既有单库配置、默认串行行为和离线查询方式。
自备双栈组合
new IP2Region({ databases: { 4: {...}, 6: {...} } })与IP2Region.open()支持相同配置。允许非空单地址族 map、不同文件格式和各自的字段布局,按实际文件能力校验地址族。结果保持各来源解释,组合元数据保留 datasets;任一加载失败会清理已创建的读取器,关闭会尝试释放全部读取器且保持幂等。配置与 source/database/families 互斥,不做回退或字段合并。异步批量有界并发
lookupManyAsync(ips, { concurrency: 4 })和 settled 版本接受公开的AsyncBatchOptions,默认 1。输入按空闲槽位读取,结果按输入顺序返回;普通批量观察到首错后停止派发、清理迭代器并等待已启动请求结束,settled 记录每项查询错误。完成通知机制避免在慢请求上重复附加 Promise.race 回调。关闭拒绝新请求并等待已启动请求,不提供隐式取消、重试或超时。数据维护
data:stage -- --revision <完整SHA> --stage <新目录>暂存固定上游候选,data:validate复查,data:apply才更新两份数据及 manifest、生成源码和文档。支持--from本地候选,并明确标记未经上游认证的 local 来源。检查所有引用记录的 UTF-8/列数,采样与独立官方 reader 对照,输出范围/记录变化、哈希、构建时间及许可摘要。拒绝被修改的 stage、已变化的基线和并发应用;写入前生成备份,处理到的替换失败会回滚。多文件应用不保证进程崩溃原子性,恢复步骤见 data/README.md。网络暂存需要 curl,离线测试不联网。使用现有开发依赖,不增加运行时依赖。本 PR 不更新现有 XDB 二进制快照。
验证