You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: remove latest_snapshot and use buffer-native peek() (M15)
Replaces the per-record latest_snapshot Mutex with a new DynBuffer::peek()
method that reads from the buffer's native storage (watch::Sender slot for
SingleLatest, Mutex<Option<T>> slot for Mailbox, None for SPMC Ring).
The snapshot was a redundant second copy of every produced value, updated
on two divergent code paths (TypedRecord::produce and RecordWriter::push),
and the only mutex on the SingleLatest hot path. After this change the
write path is unified through RecordWriter::push() and the SingleLatest
produce path is lock-free.
Also fixes a latent bug in TokioBuffer's Watch::push: it used tx.send()
which returns Err and silently drops the value when no receivers exist.
Switched to tx.send_replace() which always updates the slot — the snapshot
had been masking this for record.get callers.
Behaviour changes (documented in design 031 §Breaking Changes):
- record.get returns not_found on SPMC Ring and bufferless records
- record.get on Mailbox after record.drain returns not_found (slot was
taken; previously the independent snapshot survived)
- metadata mark_updated now fires on AimX record.set and the WASM adapter
produce paths, which previously bypassed it
Design: docs/design/031-M15-remove-latest-snapshot.md
Verified: make check (fmt, clippy, std/no_std/embedded/wasm builds, deny)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments