-
Notifications
You must be signed in to change notification settings - Fork 0
Add fairness config docs and tweak helper #147
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 |
|---|---|---|
| @@ -1,61 +1,58 @@ | ||
| # Documentation contents | ||
|
|
||
| This page summarizes each file in the `docs/` directory. | ||
| Use it as a quick reference when navigating the project's design and | ||
| architecture material. | ||
| This page summarizes each file in the `docs/` directory. Use it as a quick | ||
| reference when navigating the project's design and architecture material. | ||
|
|
||
| ## Design documents | ||
|
|
||
| - [Outbound messaging design](asynchronous-outbound-messaging-design.md) | ||
| - [Outbound messaging design](asynchronous-outbound-messaging-design.md) | ||
| Comprehensive design for server-initiated pushes. | ||
| - [Message fragments](generic-message-fragmentation-and-re-assembly-design.md) | ||
| - [Message fragments](generic-message-fragmentation-and-re-assembly-design.md) | ||
| Design for fragmenting and reassembling messages. | ||
| - [Streaming response design](multi-packet-and-streaming-responses-design.md) | ||
| - [Streaming response design](multi-packet-and-streaming-responses-design.md) | ||
| Design for handling multi-packet and streaming responses. | ||
| - [Router library design](rust-binary-router-library-design.md) | ||
| In-depth design of the binary router library. | ||
| - [Client design](wireframe-client-design.md) | ||
| Proposal for adding client-side support. | ||
| - [Frame metadata](frame-metadata.md) | ||
| How frame metadata assists with routing decisions. | ||
| - [Message versioning](message-versioning.md) | ||
| Approaches to message versioning and compatibility. | ||
| - [Preamble validator](preamble-validator.md) | ||
| Validating client connection preambles. | ||
| - [Router library design](rust-binary-router-library-design.md) In-depth design | ||
| of the binary router library. | ||
| - [Client design](wireframe-client-design.md) Proposal for adding client-side | ||
| support. | ||
| - [Frame metadata](frame-metadata.md) How frame metadata assists with routing | ||
| decisions. | ||
| - [Message versioning](message-versioning.md) Approaches to message versioning | ||
| and compatibility. | ||
| - [Preamble validator](preamble-validator.md) Validating client connection | ||
| preambles. | ||
|
|
||
| ## Roadmaps | ||
|
|
||
| - [Outbound messaging roadmap](asynchronous-outbound-messaging-roadmap.md) | ||
| Task list for implementing asynchronous outbound messaging. | ||
| - [Wireframe 1.0 roadmap](wireframe-1-0-detailed-development-roadmap.md) | ||
| - [Outbound messaging roadmap](asynchronous-outbound-messaging-roadmap.md) Task | ||
| list for implementing asynchronous outbound messaging. | ||
| - [Wireframe 1.0 roadmap](wireframe-1-0-detailed-development-roadmap.md) | ||
| Detailed tasks leading to Wireframe 1.0. | ||
| - [Project roadmap](roadmap.md) | ||
| High-level development roadmap. | ||
| - [1.0 philosophy](the-road-to-wireframe-1-0-feature-set-philosophy-and-capability-maturity.md) | ||
| - [Project roadmap](roadmap.md) High-level development roadmap. | ||
| - [1.0 philosophy](the-road-to-wireframe-1-0-feature-set-philosophy-and-capability-maturity.md) | ||
| Philosophy and feature set for Wireframe 1.0. | ||
|
|
||
| ## Testing | ||
|
|
||
| - [Multi-layered testing strategy](multi-layered-testing-strategy.md) | ||
| Overview of the library's testing approach. | ||
| - [RSTest fixtures](rust-testing-with-rstest-fixtures.md) | ||
| Using `rstest` fixtures for clean tests. | ||
| - [Mocking network outages](mocking-network-outages-in-rust.md) | ||
| Tutorial for simulating network outages in tests. | ||
| - [Testing helpers](wireframe-testing-crate.md) | ||
| Planned companion crate with testing helpers. | ||
| - [Multi-layered testing strategy](multi-layered-testing-strategy.md) Overview | ||
| of the library's testing approach. | ||
| - [RSTest fixtures](rust-testing-with-rstest-fixtures.md) Using `rstest` | ||
| fixtures for clean tests. | ||
| - [Mocking network outages](mocking-network-outages-in-rust.md) Tutorial for | ||
| simulating network outages in tests. | ||
| - [Testing helpers](wireframe-testing-crate.md) Planned companion crate with | ||
| testing helpers. | ||
|
|
||
| ## Operations and resilience | ||
|
|
||
| - [Resilience guide](hardening-wireframe-a-guide-to-production-resilience.md) | ||
| - [Resilience guide](hardening-wireframe-a-guide-to-production-resilience.md) | ||
| Guidance on achieving production resilience. | ||
| - [Observability and operability](observability-operability-and-maturity.md) | ||
| - [Observability and operability](observability-operability-and-maturity.md) | ||
| Guide to observability and operational maturity. | ||
|
|
||
| ## Reference guides | ||
|
|
||
| - [Refactoring guide](complexity-antipatterns-and-refactoring-strategies.md) | ||
| - [Refactoring guide](complexity-antipatterns-and-refactoring-strategies.md) | ||
| Strategies for taming code complexity and refactoring. | ||
| - [Documentation style guide](documentation-style-guide.md) | ||
| Conventions for writing project documentation. | ||
|
|
||
| - [Documentation style guide](documentation-style-guide.md) Conventions for | ||
| writing project documentation. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,7 +8,7 @@ use rstest::{fixture, rstest}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use tokio::time::{Duration, sleep, timeout}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use tokio_util::sync::CancellationToken; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use wireframe::{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| connection::ConnectionActor, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| connection::{ConnectionActor, FairnessConfig}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| push::PushQueues, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| response::{FrameStream, WireframeError}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -44,6 +44,31 @@ async fn strict_priority_order( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert_eq!(out, vec![1, 2, 3]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[rstest] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[tokio::test] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async fn fairness_yields_low_after_burst( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| queues: (PushQueues<u8>, wireframe::push::PushHandle<u8>), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| shutdown_token: CancellationToken, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let (queues, handle) = queues; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let fairness = FairnessConfig { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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. suggestion (testing): No test for disabling fairness (max_high_before_low = 0, time_slice = None). Please add a test to verify that when both max_high_before_low = 0 and time_slice = None, all high-priority frames are processed before any low-priority ones, as documented.
Owner
Author
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. New GitHub issue, please
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. I have created an issue for your comment: #148 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| max_high_before_low: 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| time_slice: None, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for n in 1..=5 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| handle.push_high_priority(n).await.unwrap(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| handle.push_low_priority(99).await.unwrap(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| drop(handle); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let mut actor: ConnectionActor<_, ()> = ConnectionActor::new(queues, None, shutdown_token); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| actor.set_fairness(fairness); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let mut out = Vec::new(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| actor.run(&mut out).await.unwrap(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert_eq!(out, vec![1, 2, 99, 3, 4, 5]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+47
to
+70
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. suggestion (testing): Missing test for time_slice-based fairness yielding. Please add a test that verifies yielding to the low-priority queue when time_slice is set and max_high_before_low is zero, so both fairness mechanisms are tested.
Suggested change
Owner
Author
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. New GitHub issue, please
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. I have created an issue for your comment: #150 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[rstest] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[tokio::test] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async fn shutdown_signal_precedence( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
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.
Fix Rustdoc comment placement for
max_high_before_lowfield.The documentation about zero value disabling the counter should be part of the field's doc comment, not a separate comment.
Apply this diff to fix the documentation:
pub struct FairnessConfig { /// Number of consecutive high-priority frames to process before - /// checking the low-priority queue. + /// checking the low-priority queue. A zero value disables the counter + /// and relies solely on `time_slice` for fairness, preserving strict + /// high-priority ordering otherwise. pub max_high_before_low: usize, - /// A zero value disables the counter and relies solely on `time_slice` for - /// fairness, preserving strict high-priority ordering otherwise. /// Optional time slice after which the low-priority queue is checked /// if high-priority traffic has been continuous. pub time_slice: Option<Duration>, }📝 Committable suggestion
🤖 Prompt for AI Agents
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.
New GitHub issue, please
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.
🧩 Analysis chain
@leynos I'll create a GitHub issue for the Rustdoc comment placement fix identified in the review.
🏁 Script executed:
Length of output: 1124
Perfect! I've successfully created GitHub issue #149 for the Rustdoc comment placement fix.
Issue created: #149
The issue documents the need to fix the documentation structure for the
max_high_before_lowfield in theFairnessConfigstruct, moving the zero value explanation into the proper field documentation comment as identified in the code review.🐰✨
(\ /)
( ..)
o(")(")
🧬 Code Graph Analysis Results
Relevant snippets from
src/hooks.rs(lines 22-27)This snippet shows the default initialization of
ProtocolHooks, which is used inConnectionActorto run hooks before sending frames and when a command ends.Relevant snippets from
tests/connection_actor.rs(lines 18 and 22)This test helper function creates bounded push queues, which are used by
ConnectionActorfor high- and low-priority frame delivery.This helper function creates a new shutdown token, which is used by
ConnectionActorto handle shutdown signaling.Summary of relevant code from
src/connection.rs(lines 1-180)The file defines a
ConnectionActorstruct that manages outbound frame delivery using asynchronous streams and queues. It uses atokio::select!loop with thebiasedkeyword to prioritize high-priority push queues over low-priority ones and streaming responses. The actor supports fairness configuration to balance processing between high- and low-priority frames based on count or elapsed time.Key components and methods include:
FairnessConfig: Configures how many high-priority frames are processed before yielding to low-priority frames, and optionally a time slice for fairness.ConnectionActor::newandwith_hooks: Constructors for the actor, optionally with custom protocol hooks.run: Main async method driving the actor until shutdown or all sources are exhausted.poll_sources: Usestokio::select!to poll shutdown token, high- and low-priority queues, and an optional response stream.process_*methods: Handle frames received from different sources, applying hooks and managing internal state.start_shutdown: Closes queues and drops the response stream on shutdown.handle_pushandhandle_response: Apply hooks and append frames to the output vector.after_high,should_yield_to_low_priority, andafter_lowto balance frame processing.ActorStatestruct tracks whether push queues and response streams are closed and if shutdown is in progress.This file is central to managing outbound frame flow with prioritization, fairness, and graceful shutdown.
No other snippets from the provided list appear directly relevant to understanding or addressing the
src/connection.rsfile or the user comment about creating a new GitHub issue.