-
Notifications
You must be signed in to change notification settings - Fork 50
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
Conversation
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.
Syn(Syn), | ||
Data(u64, Bytes), | ||
Fin(u64), | ||
Rst, | ||
} | ||
|
||
#[derive(Debug)] | ||
pub(crate) struct Syn { | ||
pub struct Syn { |
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.
Is there any reason you prefer pub(crate)
to pub
with visibility limited to crate at the module declaration?
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.
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)) { |
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.
Did you consider returning an iterator? Seems slightly more idiomatic
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.
It would certainly be nicer, but I don't believe we can since we need to borrow the world's ref cell.
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.