-
Notifications
You must be signed in to change notification settings - Fork 0
Document actor state consolidation #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -178,6 +178,32 @@ sequenceDiagram | |||||||||||||||||
| Note over Outbox: Holds frames while the socket is busy. | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| ### 3.4 Actor state management | ||||||||||||||||||
|
|
||||||||||||||||||
| The connection actor polls four sources: a shutdown token, high- and | ||||||||||||||||||
| low-priority push channels, and an optional response stream. Earlier drafts | ||||||||||||||||||
| tracked a boolean for each source, leading to verbose state updates. The actor | ||||||||||||||||||
| now stores each receiver as an `Option` and counts how many sources have closed. | ||||||||||||||||||
|
|
||||||||||||||||||
| ```rust | ||||||||||||||||||
| enum RunState { | ||||||||||||||||||
| Active, | ||||||||||||||||||
| ShuttingDown, | ||||||||||||||||||
| Finished, | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| struct ActorState { | ||||||||||||||||||
| run_state: RunState, | ||||||||||||||||||
| closed_sources: usize, | ||||||||||||||||||
| total_sources: usize, | ||||||||||||||||||
| } | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| `total_sources` is calculated when the actor starts. Whenever a receiver returns | ||||||||||||||||||
| `None`, it is set to `None` and `closed_sources` increments. When | ||||||||||||||||||
| `closed_sources == total_sources` the loop exits. This consolidation clarifies | ||||||||||||||||||
| progress through the actor lifecycle and reduces manual flag management. | ||||||||||||||||||
|
Comment on lines
+202
to
+205
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Missing comma after the dependent ‘When…’ clause Add a comma after the introductory clause to avoid a garden-path read and satisfy -When `closed_sources == total_sources` the loop exits.
+When `closed_sources == total_sources`, the loop exits.📝 Committable suggestion
Suggested change
🧰 Tools🪛 LanguageTool[typographical] ~204-~204: The word ‘When’ starts a question. Add a question mark (“?”) at the end of the sentence. (WRB_QUESTION_MARK) 🤖 Prompt for AI Agents |
||||||||||||||||||
|
|
||||||||||||||||||
| ## 4. Public API Surface | ||||||||||||||||||
|
|
||||||||||||||||||
| The public API is designed for ergonomics, safety, and extensibility. | ||||||||||||||||||
|
|
||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,9 @@ design documents. | |
| - [x] **Connection actor** with a biased `select!` loop that polls for shutdown, | ||
| high/low queues and response streams as described in | ||
| [Design §3.2][design-write-loop]. | ||
| - [x] **Internal protocol hooks** `before_send` and `on_command_end` invoked | ||
| - [ ] **Run state consolidation** using `Option` receivers and a closed source | ||
| counter ([Design §3.4][design-actor-state]). | ||
|
Comment on lines
+16
to
+17
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Hyphenate compound modifier ‘closed-source’ Treat “closed-source” as a compound adjective to mirror the earlier “high- and -counter ([Design §3.4][design-actor-state]).
+counter ([Design §3.4][design-actor-state]).(Only the hyphenation changes; line length preserved.)
🤖 Prompt for AI Agents |
||
| - [X] **Internal protocol hooks** `before_send` and `on_command_end` invoked | ||
| from the actor ([Design §4.3][design-hooks]). | ||
|
|
||
| ## 2. Public API and Ergonomics | ||
|
|
@@ -52,6 +54,7 @@ design documents. | |
| - [ ] **User guides and examples** demonstrating server-initiated messaging | ||
| ([Design §7][design-use-cases]). | ||
|
|
||
| [design-actor-state]: asynchronous-outbound-messaging-design.md#34-actor-state-management | ||
| [design-dlq]: asynchronous-outbound-messaging-design.md#52-optional-dead-letter-queue-dlq-for-critical-messages | ||
| [design-errors]: asynchronous-outbound-messaging-design.md#5-error-handling--resilience | ||
| [design-hooks]: asynchronous-outbound-messaging-design.md#43-configuration-via-the-wireframeprotocol-trait | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Wrap paragraph to 80 cols for guideline compliance
The two sentences currently exceed the mandated 80-character wrap for prose in
Markdown docs. Re-flowing keeps the style consistent with the rest of the
document.
🤖 Prompt for AI Agents