Skip to content

kvspace-durable: v0.3.23 ABI alignment, Ptr chain resolution, ctime cache retirement, and volatile ring buffer - #45

Open
carsontung666 wants to merge 13 commits into
array2d:mainfrom
carsontung666:fix/review-v0.3.23
Open

carsontung666 wants to merge 13 commits into
array2d:mainfrom
carsontung666:fix/review-v0.3.23

Conversation

@carsontung666

@carsontung666 carsontung666 commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Align fs and redis backends with v0.3.23 C ABI contracts: up to 16-hop leaf Ptr resolution, bare-target Ptr directory/member listing, DelTree parity, untyped ST_SLACK preservation, and /lib/*/‥ctime cross-handle cache retirement.
  • Reuse unchanged volatile control-key slots in place and expand the volatile buffer ring to 4 slots so interleaved Get/BodyView/GetHead calls within one instruction never invalidate live views.
  • Add ListLen/ListAt traversal caching, atomic fs writes, Redis I/O reconnect handling, non-destructive Redis test isolation, and deps.json header pinning.

Verification

  • cargo test: 51/51 passed (0 warnings).

…nd v0.3.23 New* ABI

- ffi: invalidate the full subtree in DelTree/CpTree/CpList (normalizing trailing slash or member separator)
- headlenpow: bound langtype_from_wire to data.len() so truncated or malformed attr trailers return None instead of panicking across C ABI
- ffi: align kvspaceNew* signatures and wire output with kvspace.h v0.3.23 (write langtype verbatim to attr; reject empty NewPtr target)
- remove unused xvalue/backend helpers and update README wire format docs
… atomic fs writes, and SCAN MATCH

- redis: drop TCP connection on I/O error or timeout so delayed replies cannot desynchronize subsequent commands
- ffi: wrap lazy flush, WriteInPlace readback, and Watch polling in catch_unwind to return 1 instead of aborting across C ABI
- fs: overwrite body in place when layout matches, otherwise write a temp file and rename atomically
- ffi: add per-handle child list snapshot for ListLen/ListAt
- redis: pass escaped MATCH prefix to server-side SCAN
… O(N)

Reuse the last list() snapshot in kvspaceListAt while (prefix, expand_ext, resolve) match, idx strictly increases, and no writes occur on the handle. Re-list on ListLen, any handle mutation, or repeated/non-increasing idx so polling callers observe external updates.
Keep a single ListCache snapshot: ListLen always re-lists (cursor = -1), sequential ListAt (idx > cursor) reuses that listing, repeated or non-increasing idx re-lists for external write visibility, and all handle write paths invalidate the cache while retaining catch_unwind guards.
Verify sequential ListAt reuse, immediate invalidation on same-handle mutations (SetValue, Del, DelTree, lazy WriteNewPlace), and cross-handle visibility on repeated idx or ListLen.
…s backends

- unify subtree deletion around store::is_subtree_key(base, key) via subtree_base
- fs: remove sibling runtime-attribute entries in the parent directory, preserve the root directory itself on DelTree("/"), and resolve only parent links so DelTree on a link deletes only the link
- backend (redis/s3): resolve only parent components before checking whether the target key is a link
- tests: add tests/deltree.rs covering fs and Redis
Add deps.json (kvspace v0.3.23) and clone kvspace at that tag when packaging release headers instead of tracking default branch HEAD.
…ped ST_SLACK values

- backend, fs: skip validate_ptr during set to support forward, multi-hop, and cyclic pointers without extra synchronous reads; validate attr_len >= 2 and trim trailing padding in kvspaceSetValue
- kvspace_common: preserve map key shapes in norm_langtype
- xvalue: decode to XValue::None only for canonical ST_SHORT + REF_INLINE + len=0 + empty langtype, and map empty kind to ST_SLACK in to_wire_head so untyped system slots round-trip and work with Watch
…tHead

- kvspaceGet, kvspaceWriteInPlace: follow leaf Ptr chains up to 16 hops when resolve != 0 (returning 1 on cycle/hop limit and 0 on dangling target), caching hops so raw and resolved borrowed views coexist
- kvspaceGetHead, kvspaceGetPart, kvspaceSetPart: resolve leaf Ptr chains through read_cache and invalidate the terminal target key on mutation
…sion suite

- cp.rs, map_coord.rs, common/mod.rs: replace kv.clear() with per-process prefixes + del_tree cleanup and skip cleanly when Redis is unreachable
- add tests/review_fixes.rs covering forward/multi-hop/cyclic/>16-hop Ptr chains, WriteInPlace(resolve=1), GetHead/GetPart/SetPart resolution, untyped ST_SLACK round-trip + Watch, and attr trailer bounds
- silence compiler warnings across test targets
…handles

Detect function ctime control-key updates in volatile_refresh and move cached snapshots under that function directory into retired so cross-handle relayout updates take effect immediately while keeping borrowed pointers valid until Close.
…ildren, and bare-target Ptr listing

- ffi: treat /lib/*/vids/* as volatile, retire read_cache across Watch and vids handoff Del, and update VolatileBuf
- fs: list directory child without trailing slash only when __self__ exists without __dir__, and preserve trailing directory/member suffix when resolving links to bare targets
- backend: preserve trailing directory/member suffix when resolving links to bare targets; add regression cases in tests/review_fixes.rs
… 4 slots

Avoid advancing or overwriting live VolatileBuf slots when a volatile control key re-reads identical bytes, preventing use-after-free when multiple borrowed Get and GetHead calls interleave within one instruction.
@carsontung666 carsontung666 changed the title fix(kvspace-durable): fs:// 持久化后端视图生命周期与一致性审查修复 kvspace-durable: v0.3.23 ABI alignment, Ptr chain resolution, ctime cache retirement, and volatile ring buffer Nov 1, 2026
miaobyte added a commit that referenced this pull request Nov 1, 2026
feat: v0.3.23 ABI 对齐与 Ptr/volatile 修复(review #45,冲突取 PR 方)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant