Skip to content

Conversation

abr-egn
Copy link
Contributor

@abr-egn abr-egn commented Sep 15, 2025

RUST-2203 / RUST-2272

This required moving metadata from something that each worker has its own copy of to a central per-Client (actually per-Topology) shared value.

I initially implemented this as an update that gets fanned out to the workers using the existing infrastructure that's there for shutdown and the like; that turned out to require a centralized copy anyway so I dropped the fan-out. In the process, though, I did some refactoring of the related methods so that worker commands require fewer intermediate pass-through wrapper methods and division of logic among the components is clearer.

@@ -656,6 +656,9 @@ pub(crate) struct TestOptions {

/// Async-capable command event listener.
pub(crate) async_event_listener: Option<TestEventSender>,

/// Callback to receive hello commands.
pub(crate) hello_cb: Option<EventHandler<crate::cmap::Command>>,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prose tests required direct visibility of hello commands, so new test hook. I used EventHandler for this because that's easier than typing Arc<Box<dyn Fn(crate::cmap::Command)>> all over the place and it already implements things like Debug.

@@ -48,12 +48,12 @@ pub(crate) struct EstablisherOptions {
pub(crate) test_patch_reply: Option<fn(&mut Result<HelloReply>)>,
}

impl From<&ClientOptions> for EstablisherOptions {
fn from(opts: &ClientOptions) -> Self {
impl From<&TopologySpec> for EstablisherOptions {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because Establisher / Handshaker now require a value outside of ClientOptions to construct, I introduced TopologySpec to capture that (and anything similar that happens to be needed in the future) rather than thread through another function parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were just construction tests of metadata values and IMO didn't have enough utility to be worth updating.

@abr-egn abr-egn marked this pull request as ready for review September 16, 2025 12:54
@abr-egn abr-egn requested a review from a team as a code owner September 16, 2025 12:54
@abr-egn abr-egn marked this pull request as draft September 16, 2025 16:38
@abr-egn abr-egn marked this pull request as ready for review September 17, 2025 17:28
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