-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: add async path strategy service class #118
Conversation
Hey @mlegner , could you please have a look at this draft? Specifically, at the If you want an idea of the intended implementation of a |
Thanks a lot for adding this important piece, @jpcsmith. I will review the code today. |
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.
Thanks again for this addition!
I haven't fully wrapped my head around tho whole design; so let me summarize my current understanding to make sure it is more or less correct:
- We have a path service (
AsyncPathService
), which provides a way to request paths, a path strategy (PathStrategy
), which determines when to refresh paths and how to cache them, and a controller (AsyncPathStrategy
andAsyncPathStrategyInner
), which combines the two and provides a convenient async interface. - Client code would instantiate an
AsyncPathStrategy
with an appropriatePathStrategy
andPathService
, which results in a new tokio task that performs the query and refresh operations.
Question: What exactly does the client do when it needs a path?
Question: How do we determine the best path of a set of paths? Would this be an additional component PathSelector
or PathRater
? There is the PathOrdering
in the PathRefresher
, but I don't really see what role that plays.
I'm not sure I fully understand the PathRefresher
implementation. Maybe I need to think about it some more...
|
Hey Markus, thanks for the feedback. Please see my responses inline below.
Your understanding is correct.
The idea here was that the "best" path would be /// When queried for a path, it returns a path with the lowest number of interface
/// hops that is not nearly expired. If no such paths are found, it returns a path
/// with the lowest number of hops that is nearly expired; or otherwise None.
pub struct PathRefresher { That being said, this could be achieved by wrapping an existing path strategy (such as a path refresher) with a strategy that selects from among the available paths, or PathRefresher could be further generalised.
Okay, it's not part of this PR and likely has several logic errors as there are currently no tests. It's now commented out as it breaks with my most recent changes. |
1bad7dc
to
56ad3cc
Compare
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.
I went through all the code except the tests and everything looks great. As usual, just some minor points.
I will look at the tests after lunch but don't expect anything major there. 🙂
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.
Nice test setup. I haven't done any mocking in Rust before, so I cannot really provide any deep feedback. I can just say that from my reading of the mockall documentation, this all seems reasonable. 😅
56ad3cc
to
7a23d8f
Compare
7a23d8f
to
c01e02c
Compare
This adds path lookup strategies.
Pending tasks: