Skip to content
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

Add network topology introspection #78

Merged
merged 2 commits into from
Jan 24, 2023
Merged

Add network topology introspection #78

merged 2 commits into from
Jan 24, 2023

Conversation

mcches
Copy link
Contributor

@mcches mcches commented Jan 19, 2023

The sim now supports iterating each host pair's network link, as well
as each message that is currently "in flight" on the network.

Link and message metadata is exposed. We can also now force delivery
of messages.

In combination with the step capabilities that were recently added we
now have the ability to run more complex test scenarios.

The sim now supports iterating each host pair's network link, as well
as each message that is currently "in flight" on the network.

Link and message metadata is exposed. We can also now force delivery
of messages.

In combination with the step capabilities that were recently added we
now have the ability to run more complex test scenarios.
@mcches mcches requested review from marcbowes and mh32 January 19, 2023 18:41
Syn(Syn),
Data(u64, Bytes),
Fin(u64),
Rst,
}

#[derive(Debug)]
pub(crate) struct Syn {
pub struct Syn {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason you prefer pub(crate) to pub with visibility limited to crate at the module declaration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No reason, just started out this way. We could go back and and fix this at some point for the internals.

@@ -192,6 +204,13 @@ impl<'a> Sim<'a> {
world.topology.set_link_fail_rate(a, b, value);
}

/// Access a [`LinksIter`] to introspect inflight messages between hosts.
pub fn links(&self, f: impl FnOnce(LinksIter)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you consider returning an iterator? Seems slightly more idiomatic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would certainly be nicer, but I don't believe we can since we need to borrow the world's ref cell.

@mcches mcches merged commit 40a336e into main Jan 24, 2023
@mcches mcches deleted the links branch January 24, 2023 13:46
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.

2 participants