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
Trivariant LookupResult type to allow authorities to decline to respond to a query #2160
base: main
Are you sure you want to change the base?
Conversation
In particular, context:
|
I'm sympathetic to the idea that this isn't the best solution, but I also think Some alternative suggestions:
What do you think? |
I like the tri-variant idea -- it has the potential to be much more clear about what data is or is not being returned and how it should be acted upon. I'm going to spend some time today investigating this a bit more - there is a LookupResult type that is typed to Result<T, LookupError> and is only used it one place in the In Memory authority. I think I'll modify that to include a Bypass variant and see what the overall change looks like. |
That's for the discussion on this. I think I agree about the TriValue to make the intention clear. The only downside I foresee is that we might end up with some ergonomics that will be lost on Option and Result. That's probably ok, and maybe there's a way gain some of those back. Anyway, I like that better as a path forward as the currently Option/Result combination seems unwieldy. |
I'll put together a separate branch with my changes related to the tri-variant..probably on Monday. I did get this working yesterday, without too much trouble, but the loss of option-/result-related methods is something to consider for sure. |
We can of course add some of our own helper methods to the enum definition, of course. |
I’ve been doing that, but so far only to the extent necessary to implement what is currently in use, which is:
unwrap
unwrap_err
expect
expect_err
map
map_err
…On Mon, Mar 4, 2024 at 7:52 AM, Dirkjan Ochtman ***@***.***(mailto:On Mon, Mar 4, 2024 at 7:52 AM, Dirkjan Ochtman <<a href=)> wrote:
We can of course add some of our own helper methods to the enum definition, of course.
—
Reply to this email directly, [view it on GitHub](#2160 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AE7LXV67LVDY6M5W6ZQ5OIDYWR4A3AVCNFSM6AAAAABEAQQMBGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZWGYZDQMJQHE).
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
…sult, change map(|l| Box::new ... calls to use map_dyn()
d560fd3
to
fdd83bd
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.
IMO this is looking pretty good. Probably still good to get a review from @bluejekyll, as well.
sections.soa.iter(), | ||
sections.additionals.iter(), | ||
); | ||
match response { |
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.
Style nit: to reduce rightward drift, it would be nice to have early returns for the Err
and Skip
cases, and yield the lookup
out of the match
for further handling.
For a bunch of these match
es, maybe use LookupResult::*
just before the match
to reduce the noise a bit?
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 resolved some of my comments -- @marcus0x62 have you looked at it? I think we could merge this if that was resolved. |
This PR contains changes to the lookup, search, and related authority functions that wrap the lookup in an Option. This is to allow authorities to use None to signal when a lookup was not found, but that searching should continue using other authorities configured in an authority chain.
The current use case is for the block list authority.
This also changes the lookup and build_response logic in catalog.rs to not call send_authoritative_response or send_forwarded_response if None is returned.
The use case for this is so that when an authority like the block list is consulted, we do not leak the request to other authorities for requests the user wants to block, and we do not incur extra latency by waiting for a timeout when the block list can immediately signal it does not have an answer for a particular query.
See discussion here and more generally in PR #2113