pub enum LookupControlFlow<T, E = LookupError> {
Continue(Result<T, E>),
Break(Result<T, E>),
Skip,
}Expand description
Result of a Lookup in the Catalog and Authority
- All authorities should default to using LookupControlFlow::Continue to wrap their responses. These responses may be passed to other authorities for analysis or requery purposes.
- Authorities may use LookupControlFlow::Break to indicate the response must be returned immediately to the client, without consulting any other authorities. For example, if the the user configures a blocklist authority, it would not be appropriate to pass the query to any additional authorities to try to resolve, as that might be used to leak information to a hostile party, and so a blocklist (or similar) authority should wrap responses for any blocklist hits in LookupControlFlow::Break.
- Authorities may use LookupControlFlow::Skip to indicate the authority did not attempt to process a particular query. This might be used, for example, in a block list authority for any queries that did not match the blocklist, to allow the recursor or forwarder to resolve the query. Skip must not be used to represent an empty lookup; (use Continue(EmptyLookup) or Break(EmptyLookup) for that.)
Variants§
Continue(Result<T, E>)
A lookup response that may be passed to one or more additional authorities before being returned to the client.
Break(Result<T, E>)
A lookup response that must be immediately returned to the client without consulting any other authorities.
Skip
The authority did not answer the query and the next authority in the chain should be consulted.
Implementations§
Source§impl<T, E> LookupControlFlow<T, E>
The following are a minimal set of methods typically used with Result or Option, and that
were used in the server code or test suite prior to when the LookupControlFlow type was created
(authority lookup functions previously returned a Result over a Lookup or LookupError type.)
impl<T, E> LookupControlFlow<T, E>
The following are a minimal set of methods typically used with Result or Option, and that were used in the server code or test suite prior to when the LookupControlFlow type was created (authority lookup functions previously returned a Result over a Lookup or LookupError type.)
Sourcepub fn is_continue(&self) -> bool
pub fn is_continue(&self) -> bool
Return true if self is LookupControlFlow::Continue
Sourcepub fn map_result(self) -> Option<Result<T, E>>
pub fn map_result(self) -> Option<Result<T, E>>
Maps inner Ok(T) and Err(E) to Some(Result<T,E>) and Skip to None
Source§impl<T: LookupObject + 'static, E: Display> LookupControlFlow<T, E>
impl<T: LookupObject + 'static, E: Display> LookupControlFlow<T, E>
Sourcepub fn expect(self, msg: &str) -> T
pub fn expect(self, msg: &str) -> T
Return inner Ok variant or panic with a custom error message.
Sourcepub fn expect_err(self, msg: &str) -> E
pub fn expect_err(self, msg: &str) -> E
Return inner Err variant or panic with a custom error message.
Sourcepub fn unwrap_err(self) -> E
pub fn unwrap_err(self) -> E
Return inner Err variant or panic
Sourcepub fn unwrap_or_default(self) -> Twhere
T: Default,
pub fn unwrap_or_default(self) -> Twhere
T: Default,
Return inner Ok Variant or default value
Sourcepub fn map<U, F: FnOnce(T) -> U>(self, op: F) -> LookupControlFlow<U, E>
pub fn map<U, F: FnOnce(T) -> U>(self, op: F) -> LookupControlFlow<U, E>
Maps inner Ok(T) to Ok(U), passing inner Err and Skip values unchanged.
Sourcepub fn map_dyn(self) -> LookupControlFlow<Box<dyn LookupObject>, E>
pub fn map_dyn(self) -> LookupControlFlow<Box<dyn LookupObject>, E>
Maps inner Ok(T) to Ok(Box<dyn LookupObject>), passing inner Err and Skip values unchanged.
Sourcepub fn map_err<U, F: FnOnce(E) -> U>(self, op: F) -> LookupControlFlow<T, U>
pub fn map_err<U, F: FnOnce(E) -> U>(self, op: F) -> LookupControlFlow<T, U>
Maps inner Err(T) to Err(U), passing Ok and Skip values unchanged.