Skip to content

Commit

Permalink
Merge pull request #292 from umccr/refactor/rename-features
Browse files Browse the repository at this point in the history
refactor: rename features
  • Loading branch information
mmalenic authored Jan 6, 2025
2 parents a5af714 + 752c877 commit d0429b0
Show file tree
Hide file tree
Showing 41 changed files with 159 additions and 161 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: cargo build --all-targets --all-features
- name: Build no default features
run: cargo build --all-targets --no-default-features
- name: Build s3-storage
run: cargo build --all-targets --features s3-storage
- name: Build url-storage
run: cargo build --all-targets --features url-storage
- name: Build aws
run: cargo build --all-targets --features aws
- name: Build url
run: cargo build --all-targets --features url
4 changes: 2 additions & 2 deletions htsget-actix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ homepage = "https://github.com/umccr/htsget-rs/blob/main/htsget-actix/README.md"
repository = "https://github.com/umccr/htsget-rs"

[features]
s3-storage = ["htsget-config/s3-storage", "htsget-search/s3-storage", "htsget-http/s3-storage", "htsget-axum/s3-storage", "htsget-test/s3-storage"]
url-storage = ["htsget-config/url-storage", "htsget-search/url-storage", "htsget-http/url-storage", "htsget-axum/url-storage", "htsget-test/url-storage"]
aws = ["htsget-config/aws", "htsget-search/aws", "htsget-http/aws", "htsget-axum/aws", "htsget-test/aws"]
url = ["htsget-config/url", "htsget-search/url", "htsget-http/url", "htsget-axum/url", "htsget-test/url"]
experimental = [
"htsget-config/experimental",
"htsget-search/experimental",
Expand Down
4 changes: 2 additions & 2 deletions htsget-actix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ are exposed in the public API.
#### Feature flags

This crate has the following features:
* `s3-storage`: used to enable `S3` location functionality.
* `url-storage`: used to enable `Url` location functionality.
* `aws`: used to enable `S3` location functionality.
* `url`: used to enable `Url` location functionality.
* `experimental`: used to enable experimental features that aren't necessarily part of the htsget spec, such as Crypt4GH support through `C4GHStorage`.

## Benchmarks
Expand Down
22 changes: 11 additions & 11 deletions htsget-axum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ homepage = "https://github.com/umccr/htsget-rs/blob/main/htsget-axum/README.md"
repository = "https://github.com/umccr/htsget-rs"

[features]
s3-storage = [
"htsget-config/s3-storage",
"htsget-search/s3-storage",
"htsget-test/s3-storage",
"htsget-test/aws-mocks",
"htsget-http/s3-storage"
aws = [
"htsget-config/aws",
"htsget-search/aws",
"htsget-test/aws",
"htsget-test/aws",
"htsget-http/aws"
]
url-storage = [
"htsget-config/url-storage",
"htsget-search/url-storage",
"htsget-test/url-storage",
"htsget-http/url-storage"
url = [
"htsget-config/url",
"htsget-search/url",
"htsget-test/url",
"htsget-http/url"
]
experimental = [
"htsget-config/experimental",
Expand Down
10 changes: 5 additions & 5 deletions htsget-axum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ This crate uses [htsget-config] for configuration.
Using the default configuration, this will start a ticket server on `127.0.0.1:8080` and a data block server on `127.0.0.1:8081`
with data accessible from the [`data`][data] directory. This application supports storage backends defined in [htsget-storage].

To use `S3Storage`, compile with the `s3-storage` feature:
To use `S3Storage`, compile with the `aws` feature:
```sh
cargo run -p htsget-axum --features s3-storage
cargo run -p htsget-axum --features aws
```

This will start a ticket server with `S3Storage` using a bucket called `"data"`.

To use `UrlStorage`, compile with the `url-storage` feature.
To use `UrlStorage`, compile with the `url` feature.

See [htsget-search] for details on how to structure files.

Expand Down Expand Up @@ -178,8 +178,8 @@ htsget-rs. It also contains the data block server which fetches data from a `Loc
#### Feature flags

This crate has the following features:
* `s3-storage`: used to enable `S3` location functionality.
* `url-storage`: used to enable `Url` location functionality.
* `aws`: used to enable `S3` location functionality and any other AWS features.
* `url`: used to enable `Url` location functionality.
* `experimental`: used to enable experimental features that aren't necessarily part of the htsget spec, such as Crypt4GH support through `C4GHStorage`.

## License
Expand Down
4 changes: 2 additions & 2 deletions htsget-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ homepage = "https://github.com/umccr/htsget-rs/blob/main/htsget-config/README.md
repository = "https://github.com/umccr/htsget-rs"

[features]
s3-storage = ["dep:aws-sdk-secretsmanager", "dep:aws-config", "dep:tempfile"]
url-storage = ["dep:reqwest", "dep:cfg-if"]
aws = ["dep:aws-sdk-secretsmanager", "dep:aws-config", "dep:tempfile"]
url = ["dep:reqwest", "dep:cfg-if"]
experimental = ["dep:crypt4gh", "dep:tokio", "dep:futures-util"]
default = []

Expand Down
8 changes: 4 additions & 4 deletions htsget-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ data_server = "None"
> [!IMPORTANT]
> Some parts of htsget-rs require extra feature flags for conditional compilation, that's why the examples specify
> using `--all-features`. Notably, `--features s3-storage` enables the `S3` location type, and `--features url-storage`
> using `--all-features`. Notably, `--features aws` enables the `S3` location type, and `--features url`
> enabled the remote HTTP server location type. If using a subset of features, for example S3 locations only, then
> a single feature can be enabled instead of using `--all-features`.
Expand Down Expand Up @@ -387,7 +387,7 @@ backend.keys.private = "data/c4gh/keys/bob.sec" # pragma: allowlist secret
backend.keys.public = "data/c4gh/keys/alice.pub"
```

Keys can also be retrieved from [AWS Secrets Manager][secrets-manager]. Compile with the `s3-storage` feature flag and specify `keys.kind = "SecretsManager"` under
Keys can also be retrieved from [AWS Secrets Manager][secrets-manager]. Compile with the `aws` feature flag and specify `keys.kind = "SecretsManager"` under
`location` to fetch keys from Secrets Manager. When using Secrets Manager, the `private` and `public`
correspond to ARNs or secret names in Secrets Manager storing PEM formatted keys.

Expand Down Expand Up @@ -447,8 +447,8 @@ regex, and changing it by using a substitution string. Advanced configuration op
### Feature flags

This crate has the following features:
* `s3-storage`: used to enable `S3` location functionality.
* `url-storage`: used to enable `Url` location functionality.
* `aws`: used to enable `S3` location functionality and any other AWS features.
* `url`: used to enable `Url` location functionality.
* `experimental`: used to enable experimental features that aren't necessarily part of the htsget spec, such as Crypt4GH support through `C4GHStorage`.

## License
Expand Down
2 changes: 1 addition & 1 deletion htsget-config/examples/config-files/c4gh.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# An example of running htsget-rs with Crypt4GH enabled.
# Run with `cargo run -p htsget-axum --features experimental,s3-storage -- --config htsget-config/examples/config-files/c4gh.toml`
# Run with `cargo run -p htsget-axum --all-features -- --config htsget-config/examples/config-files/c4gh.toml`

ticket_server.addr = "127.0.0.1:8080"
data_server.addr = "127.0.0.1:8081"
Expand Down
2 changes: 1 addition & 1 deletion htsget-config/examples/config-files/s3_storage.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# An example for a server which uses s3 storage with data located in "bucket".
# Run with `cargo run -p htsget-axum --features s3-storage -- --config htsget-config/examples/config-files/s3_storage.toml`
# Run with `cargo run -p htsget-axum --all-features -- --config htsget-config/examples/config-files/s3_storage.toml`

ticket_server.cors.allow_headers = "All"
ticket_server.cors.allow_methods = "All"
Expand Down
2 changes: 1 addition & 1 deletion htsget-config/examples/config-files/tls_data_server.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# An example config file for a TLS data server that uses a local storage backend.
# Run with `cargo run -p htsget-axum -- --config htsget-config/examples/config-files/tls_data_server.toml`
# Run with `cargo run -p htsget-axum --all-features -- --config htsget-config/examples/config-files/tls_data_server.toml`

ticket_server.addr = "0.0.0.0:8080"
data_server.addr = "0.0.0.0:8081"
Expand Down
2 changes: 1 addition & 1 deletion htsget-config/examples/config-files/tls_ticket_server.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# An example config file for a TLS ticket server that uses S3 as a storage backend.
# Run with `cargo run -p htsget-axum --features s3-storage -- --config htsget-config/examples/config-files/tls_ticket_server.toml`
# Run with `cargo run -p htsget-axum --all-features -- --config htsget-config/examples/config-files/tls_ticket_server.toml`

ticket_server.addr = "0.0.0.0:8080"
ticket_server.cors_allow_origins = "All"
Expand Down
2 changes: 1 addition & 1 deletion htsget-config/examples/config-files/url_storage.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# An example for a server which uses url storage with data located at "http://localhost:3000".
# Run with
# `cargo run -p htsget-axum --features url-storage -- --config htsget-config/examples/config-files/url_storage.toml`
# `cargo run -p htsget-axum --all-features -- --config htsget-config/examples/config-files/url_storage.toml`
# in the project directory.

ticket_server.addr = "127.0.0.1:8082"
Expand Down
4 changes: 2 additions & 2 deletions htsget-config/src/config/advanced/allow_guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl QueryAllowed for AllowGuard {
mod tests {
use super::*;
use crate::config::tests::test_serialize_and_deserialize;
#[cfg(feature = "s3-storage")]
#[cfg(feature = "aws")]
use crate::config::Config;
use crate::types::Class::Header;

Expand Down Expand Up @@ -265,7 +265,7 @@ mod tests {
);
}

#[cfg(feature = "s3-storage")]
#[cfg(feature = "aws")]
#[test]
fn allow_guard() {
test_serialize_and_deserialize(
Expand Down
2 changes: 1 addition & 1 deletion htsget-config/src/config/advanced/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
pub mod allow_guard;
pub mod cors;
pub mod regex_location;
#[cfg(feature = "url-storage")]
#[cfg(feature = "url")]
pub mod url;

/// Determines which tracing formatting style to use.
Expand Down
6 changes: 3 additions & 3 deletions htsget-config/src/config/advanced/regex_location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ mod tests {
);
}

#[cfg(feature = "s3-storage")]
#[cfg(feature = "aws")]
#[test]
fn regex_location_s3() {
test_serialize_and_deserialize(
Expand Down Expand Up @@ -127,7 +127,7 @@ mod tests {
);
}

#[cfg(feature = "url-storage")]
#[cfg(feature = "url")]
#[test]
fn regex_location_url() {
test_serialize_and_deserialize(
Expand Down Expand Up @@ -158,7 +158,7 @@ mod tests {
);
}

#[cfg(all(feature = "url-storage", feature = "s3-storage"))]
#[cfg(all(feature = "url", feature = "aws"))]
#[test]
fn regex_location_multiple() {
test_serialize_and_deserialize(
Expand Down
10 changes: 5 additions & 5 deletions htsget-config/src/config/location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::types::Scheme;
use serde::de::Error;
use serde::{Deserialize, Deserializer, Serialize};
use std::result;
#[cfg(feature = "url-storage")]
#[cfg(feature = "url")]
use {crate::config::advanced::url::Url, crate::error, http::Uri};

/// The locations of data.
Expand Down Expand Up @@ -214,7 +214,7 @@ impl<'de> Deserialize<'de> for StringLocation {
});
}

#[cfg(feature = "s3-storage")]
#[cfg(feature = "aws")]
if let Some(s) = s.strip_prefix("s3://") {
let (bucket, prefix) = split(s)?;
return Ok(StringLocation {
Expand All @@ -223,7 +223,7 @@ impl<'de> Deserialize<'de> for StringLocation {
});
}

#[cfg(feature = "url-storage")]
#[cfg(feature = "url")]
if let Some(s_stripped) = s
.strip_prefix("http://")
.or_else(|| s.strip_prefix("https://"))
Expand Down Expand Up @@ -330,7 +330,7 @@ mod tests {
);
}

#[cfg(feature = "s3-storage")]
#[cfg(feature = "aws")]
#[test]
fn location_s3() {
test_serialize_and_deserialize(
Expand Down Expand Up @@ -364,7 +364,7 @@ mod tests {
);
}

#[cfg(feature = "url-storage")]
#[cfg(feature = "url")]
#[test]
fn location_url() {
test_serialize_and_deserialize(
Expand Down
8 changes: 4 additions & 4 deletions htsget-config/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pub(crate) mod tests {
use crate::types::Scheme;
use figment::Jail;
use http::uri::Authority;
#[cfg(feature = "url-storage")]
#[cfg(feature = "url")]
use http::Uri;
use serde::de::DeserializeOwned;
use serde_json::json;
Expand Down Expand Up @@ -572,7 +572,7 @@ pub(crate) mod tests {
);
}

#[cfg(feature = "s3-storage")]
#[cfg(feature = "aws")]
#[test]
fn simple_locations_s3() {
test_config_from_file(
Expand All @@ -590,7 +590,7 @@ pub(crate) mod tests {
);
}

#[cfg(feature = "url-storage")]
#[cfg(feature = "url")]
#[test]
fn simple_locations_url() {
test_config_from_file(
Expand Down Expand Up @@ -621,7 +621,7 @@ pub(crate) mod tests {
);
}

#[cfg(feature = "s3-storage")]
#[cfg(feature = "aws")]
#[test]
fn simple_locations_multiple_mixed() {
test_config_from_file(
Expand Down
Loading

0 comments on commit d0429b0

Please sign in to comment.