summaryrefslogtreecommitdiff
path: root/angelsharkd/src/routes/extensions/mod.rs
diff options
context:
space:
mode:
authorCarpenter, Adam (CORP) <adam.carpenter@adp.com>2021-11-30 15:22:37 -0500
committerCarpenter, Adam (CORP) <adam.carpenter@adp.com>2021-11-30 15:22:37 -0500
commitcd9f750990166dfa9b9fc0276749be307e26d008 (patch)
tree963bae4a76c06d6f89636eccb633dc06bc206620 /angelsharkd/src/routes/extensions/mod.rs
parent1fab7c878d55a307e5ef2078801be231b13ebab8 (diff)
downloadaltruistic-angelshark-cd9f750990166dfa9b9fc0276749be307e26d008.tar.xz
altruistic-angelshark-cd9f750990166dfa9b9fc0276749be307e26d008.zip
refactor: module structure and comments
Diffstat (limited to 'angelsharkd/src/routes/extensions/mod.rs')
-rw-r--r--angelsharkd/src/routes/extensions/mod.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/angelsharkd/src/routes/extensions/mod.rs b/angelsharkd/src/routes/extensions/mod.rs
index adcea3f..7f217d6 100644
--- a/angelsharkd/src/routes/extensions/mod.rs
+++ b/angelsharkd/src/routes/extensions/mod.rs
@@ -6,18 +6,22 @@ mod simple_deprov;
#[cfg(feature = "simple_search")]
mod simple_search;
+/// The extension filter; consists of all compiled optional Angelshark extension
+/// filters combined under `/extensions`.
pub fn filter(config: &Config) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
// Note: this next line deals with the common edge case of having no
// extensions loaded with feature flags. It ensures that the the type
// checking is right when the return `.and()` is called below.
let filters = default().or(default());
+ // Block to enable simple_search extension feature. Instantiates a
+ // searchable haystack and configures filters to handle search requests.
#[cfg(feature = "simple_search")]
let haystack = simple_search::Haystack::new(config.runner.clone());
#[cfg(feature = "simple_search")]
let filters = filters
- .or(simple_search::search(haystack.clone()))
- .or(simple_search::refresh(haystack));
+ .or(simple_search::search_filter(haystack.clone()))
+ .or(simple_search::refresh_filter(haystack));
#[cfg(feature = "simple_deprov")]
let filters = filters.or(simple_deprov::filter());
@@ -25,6 +29,7 @@ pub fn filter(config: &Config) -> impl Filter<Extract = impl Reply, Error = Reje
path("extensions").and(filters)
}
+/// The default, informational extension route.
fn default() -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
warp::path::end().map(|| "Angelshark extension route index. Enable extensions with feature switches and access them at `/extensions/<feature>`.")
}