Skip to content

feat(watch): finalize latest-state API - #256

Merged
tisonkun merged 3 commits into
apache:mainfrom
tisonkun:codex/watch-send-replace
Aug 31, 2026
Merged

tisonkun merged 3 commits into
apache:mainfrom
tisonkun:codex/watch-send-replace

Conversation

@tisonkun

Copy link
Copy Markdown
Member

Summary

  • require watched values to be Clone and expose owned reads through Receiver::get and Receiver::recv
  • make Receiver::changed notification-only and replace the borrow-named APIs
  • add Sender::send_replace, including retained updates when no receivers exist
  • define concurrent senders as serialized, unordered writers to a latest-state register

Design Notes

Values are cloned while the internal state lock is held. Callers with expensive state can use T = Arc<U> to keep cloning cheap while avoiding a public lock-backed guard. recv clones the latest state and advances the receiver to the matching version.

send keeps its existing no-receiver failure behavior; send_replace always publishes and returns the previous retained value.

Validation

  • cargo x test
  • cargo x check
  • cargo x lint

Closes #251.

@tisonkun
tisonkun enabled auto-merge (squash) August 31, 2026 14:03
@tisonkun
tisonkun merged commit 3dab42d into apache:main Aug 31, 2026
10 checks passed
@tisonkun
tisonkun deleted the codex/watch-send-replace branch August 31, 2026 14:05
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.

design(watch): finalize value ownership and sender state APIs

1 participant