来源: docs/design.md §3.2 WAL Oracle 架构审查
设计中多处要求 API 层 Get 必须区分 "key exists with empty value" 与 "key not found":
Get
Put + Inline
valLen = 0
Put(key, emptyValue)
[]byte
found
但在 §1.5 功能范围和 §3.4 读路径中没有定义 Get 的具体 API 签名。
Get 的 API 签名。推荐方案:
// GetResult 表示 Get 操作的结果 type GetResult struct { Value []byte Found bool // true = key 存在(value 可能为空);false = key 不存在 } // Get 读取 key 的值 func (db *DB) Get(key []byte) (GetResult, error)
或者等价的:
func (db *DB) Get(key []byte) (value []byte, found bool, err error)
No dependencies set.
The note is not visible to the blocked user.
来源: docs/design.md §3.2 WAL Oracle 架构审查
问题描述
设计中多处要求 API 层
Get必须区分 "key exists with empty value" 与 "key not found":Put + Inline允许valLen = 0,表示 key 存在且 value 为空 bytes"Put(key, emptyValue)必须依赖 API 区分 key exists with empty value 与 key not found"Get不能只返回[]byte;必须返回found或等价状态"但在 §1.5 功能范围和 §3.4 读路径中没有定义
Get的具体 API 签名。需要明确
Get的 API 签名。推荐方案:或者等价的:
影响范围