Skip to content

refactor(channel): simplify channel structure - #234

Merged
tisonkun merged 3 commits into
mainfrom
codex/simplify-channel-structure
Aug 29, 2026
Merged

refactor(channel): simplify channel structure#234
tisonkun merged 3 commits into
mainfrom
codex/simplify-channel-structure

Conversation

@tisonkun

@tisonkun tisonkun commented Aug 29, 2026

Copy link
Copy Markdown
Member

Summary

  • flatten the oneshot, mpsc, broadcast, and watch source modules to match their root public modules while preserving every public import path
  • preserve WaitSet fan-out when one wake callback panics, apply the shared wake path to watch, broadcast, barriers, and countdown primitives, and cover the regression at both the internal and watch API boundaries
  • remove unused receiver_count inspection APIs from watch and broadcast, simplify endpoint decrements while retaining checked endpoint growth and version increments, and remove implementation-only overflow tests
  • reserve disconnected terminology for channel state while describing lifecycle directly in terms of senders and receivers being dropped
  • replace ambiguous broadcast buffer_len and receiver len inspection methods with retained_message_count and unread_message_count, and remove the redundant receiver is_empty

Design Notes

The shared wake helper adds no catch_unwind call to the normal path. It owns the remaining iterator through a drop guard; if one callback panics, the guard attempts every later wake while suppressing secondary panics, then lets the original panic continue.

Endpoint growth remains checked because wrapping a live sender or receiver count would corrupt disconnection detection. Drops use direct subtraction because each successfully constructed sender or receiver contributes exactly one decrement. Future shared ring, sequencer, or Disruptor machinery can live under internal without restoring a private channel source layer.

Broadcast inspection names describe their measurement scope directly: retained_message_count reports the shared backlog kept alive by the slowest active receiver, while unread_message_count reports the backlog visible to one receiver. Both are instantaneous snapshots rather than synchronization guarantees.

Follow-up to #233.

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