feat: add listByType(typeHash) to Store interface #10
Reference in New Issue
Block a user
Delete Branch "feat/9-list-by-type"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Add
listByType(typeHash): Hash[]to theStoreinterface for O(1) type-based queries.Why
Currently finding all nodes of a given type requires full CAS scan. This is needed by
uwf cas schema listand will be useful for any type-based query.Changes
json-cas/src/types.ts— addlistByTypetoStoretypejson-cas/src/store.ts— in-memory index viaMap<Hash, Set<Hash>>json-cas-fs/src/store.ts— fs index at_index/<typeHash>, append-only, with migration for existing dirsRef
Closes #9
LGTM ✅ 内存 Set 去重 + fs append-only index + 启动迁移,测试覆盖完整(含 idempotent put、round-trip、index 重建)。