Skip to content

Commit c653daa

Browse files
authored
Merge pull request #265 from umccr/feat/c4gh-misc
refactor: C4GH and storage changes
2 parents 73d230c + bca364f commit c653daa

File tree

47 files changed

+2199
-1727
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2199
-1727
lines changed

Cargo.lock

Lines changed: 699 additions & 537 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

htsget-actix/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ repository = "https://github.com/umccr/htsget-rs"
1313
[features]
1414
s3-storage = ["htsget-config/s3-storage", "htsget-search/s3-storage", "htsget-http/s3-storage", "htsget-axum/s3-storage", "htsget-test/s3-storage"]
1515
url-storage = ["htsget-config/url-storage", "htsget-search/url-storage", "htsget-http/url-storage", "htsget-axum/url-storage", "htsget-test/url-storage"]
16-
c4gh-experimental = [
17-
"htsget-config/c4gh-experimental",
18-
"htsget-search/c4gh-experimental",
19-
"htsget-http/c4gh-experimental",
20-
"htsget-axum/c4gh-experimental",
21-
"htsget-test/c4gh-experimental"
16+
experimental = [
17+
"htsget-config/experimental",
18+
"htsget-search/experimental",
19+
"htsget-http/experimental",
20+
"htsget-axum/experimental",
21+
"htsget-test/experimental"
2222
]
2323
default = []
2424

htsget-actix/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This crate is used for running a local instance of htsget-rs. It is based on:
3131

3232
## Usage
3333

34-
This application has the same functionality as [htsget-axum]. To use it, following the [htsget-axum][htsget-axum-usage] instructions, and
34+
This application has the same functionality as [htsget-axum]. To use it, following the [htsget-axum][htsget-axum] instructions, and
3535
replace any calls to `htsget-axum` with `htsget-actix`.
3636

3737
It is recommended to use [htsget-axum] because it better fits with the rest of [htsget-rs]. For example [htsget-actix]
@@ -50,7 +50,7 @@ are exposed in the public API.
5050
This crate has the following features:
5151
* `s3-storage`: used to enable `S3Storage` functionality.
5252
* `url-storage`: used to enable `UrlStorage` functionality.
53-
* `c4gh-experimental`: used to enable `C4GHStorage` functionality.
53+
* `experimental`: used to enable `C4GHStorage` functionality.
5454

5555
## Benchmarks
5656
Benchmarks for this crate written using [Criterion.rs][criterion-rs], and aim to compare the performance of this crate with the
@@ -76,6 +76,7 @@ cargo bench -p htsget-axum -- HEAVY
7676
[criterion-rs]: https://github.com/bheisler/criterion.rs
7777
[htsget-refserver]: https://github.com/ga4gh/htsget-refserver
7878
[data-vcf]: ../data/vcf
79+
[htsget-axum]: ../htsget-axum/README.md#usage
7980

8081
## License
8182

htsget-actix/src/handlers/get.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use super::handle_response;
1717

1818
/// GET request reads endpoint
1919
#[instrument(skip(app_state))]
20-
pub async fn reads<H: HtsGet + Send + Sync + 'static>(
20+
pub async fn reads<H: HtsGet + Clone + Send + Sync + 'static>(
2121
request: Query<HashMap<String, String>>,
2222
path: Path<String>,
2323
http_request: HttpRequest,
@@ -32,7 +32,7 @@ pub async fn reads<H: HtsGet + Send + Sync + 'static>(
3232

3333
/// GET request variants endpoint
3434
#[instrument(skip(app_state))]
35-
pub async fn variants<H: HtsGet + Send + Sync + 'static>(
35+
pub async fn variants<H: HtsGet + Clone + Send + Sync + 'static>(
3636
request: Query<HashMap<String, String>>,
3737
path: Path<String>,
3838
http_request: HttpRequest,

htsget-actix/src/handlers/post.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use super::handle_response;
1818

1919
/// POST request reads endpoint
2020
#[instrument(skip(app_state))]
21-
pub async fn reads<H: HtsGet + Send + Sync + 'static>(
21+
pub async fn reads<H: HtsGet + Clone + Send + Sync + 'static>(
2222
request: Query<HashMap<String, String>>,
2323
body: Json<PostRequest>,
2424
path: Path<String>,
@@ -42,7 +42,7 @@ pub async fn reads<H: HtsGet + Send + Sync + 'static>(
4242

4343
/// POST request variants endpoint
4444
#[instrument(skip(app_state))]
45-
pub async fn variants<H: HtsGet + Send + Sync + 'static>(
45+
pub async fn variants<H: HtsGet + Clone + Send + Sync + 'static>(
4646
request: Query<HashMap<String, String>>,
4747
body: Json<PostRequest>,
4848
path: Path<String>,

htsget-actix/src/handlers/service_info.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::AppState;
1212

1313
/// Gets the JSON to return for a service-info endpoint
1414
#[instrument(skip(app_state))]
15-
pub fn get_service_info_json<H: HtsGet + Send + Sync + 'static>(
15+
pub fn get_service_info_json<H: HtsGet + Clone + Send + Sync + 'static>(
1616
app_state: &AppState<H>,
1717
endpoint: Endpoint,
1818
) -> impl Responder {
@@ -26,14 +26,14 @@ pub fn get_service_info_json<H: HtsGet + Send + Sync + 'static>(
2626
}
2727

2828
/// Gets the JSON to return for the reads service-info endpoint
29-
pub async fn reads_service_info<H: HtsGet + Send + Sync + 'static>(
29+
pub async fn reads_service_info<H: HtsGet + Clone + Send + Sync + 'static>(
3030
app_state: Data<AppState<H>>,
3131
) -> impl Responder {
3232
get_service_info_json(app_state.get_ref(), Endpoint::Reads)
3333
}
3434

3535
/// Gets the JSON to return for the variants service-info endpoint
36-
pub async fn variants_service_info<H: HtsGet + Send + Sync + 'static>(
36+
pub async fn variants_service_info<H: HtsGet + Clone + Send + Sync + 'static>(
3737
app_state: Data<AppState<H>>,
3838
) -> impl Responder {
3939
get_service_info_json(app_state.get_ref(), Endpoint::Variants)

htsget-actix/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::sync::Arc;
2-
31
use actix_cors::Cors;
42
use actix_web::dev::Server;
53
use actix_web::{web, App, HttpServer};
@@ -18,19 +16,19 @@ pub mod handlers;
1816

1917
/// Represents the actix app state.
2018
pub struct AppState<H: HtsGet> {
21-
pub htsget: Arc<H>,
19+
pub htsget: H,
2220
pub config_service_info: ServiceInfo,
2321
}
2422

2523
/// Configure the query server.
26-
pub fn configure_server<H: HtsGet + Send + Sync + 'static>(
24+
pub fn configure_server<H: HtsGet + Clone + Send + Sync + 'static>(
2725
service_config: &mut web::ServiceConfig,
2826
htsget: H,
2927
config_service_info: ServiceInfo,
3028
) {
3129
service_config
3230
.app_data(web::Data::new(AppState {
33-
htsget: Arc::new(htsget),
31+
htsget,
3432
config_service_info,
3533
}))
3634
.service(

htsget-axum/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ url-storage = [
2424
"htsget-test/url-storage",
2525
"htsget-http/url-storage"
2626
]
27-
c4gh-experimental = [
28-
"htsget-config/c4gh-experimental",
29-
"htsget-search/c4gh-experimental",
30-
"htsget-test/c4gh-experimental",
31-
"htsget-http/c4gh-experimental"
27+
experimental = [
28+
"htsget-config/experimental",
29+
"htsget-search/experimental",
30+
"htsget-test/experimental",
31+
"htsget-http/experimental"
3232
]
3333
default = []
3434

@@ -40,7 +40,7 @@ tower-http = { version = "0.5", features = ["trace", "cors", "fs"] }
4040
http = "1"
4141
axum = { version = "0.7", features = ["http2"] }
4242
axum-extra = { version = "0.9", features = ["erased-json"] }
43-
tower = { version = "0.4", features = ["make"] }
43+
tower = { version = "0.5", features = ["make", "util"] }
4444

4545
# Async
4646
tokio-rustls = "0.26"

htsget-axum/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ for more details on how to configure this.
108108
Run the server with the following to enable Crypt4GH support using the [example config][example-config]:
109109

110110
```sh
111-
cargo run -p htsget-axum --features c4gh-experimental -- --config htsget-config/examples/config-files/c4gh.toml
111+
cargo run -p htsget-axum --features experimental -- --config htsget-config/examples/config-files/c4gh.toml
112112
```
113113

114114
Crypt4GH encrypted byte ranges can be queried:
@@ -171,7 +171,7 @@ htsget-rs. It also contains the data block server which fetches data from a `Loc
171171
This crate has the following features:
172172
* `s3-storage`: used to enable `S3Storage` functionality.
173173
* `url-storage`: used to enable `UrlStorage` functionality.
174-
* `c4gh-experimental`: used to enable `C4GHStorage` functionality.
174+
* `experimental`: used to enable `C4GHStorage` functionality.
175175

176176
## License
177177

htsget-axum/src/handlers/post.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::server::AppState;
1414
use super::handle_response;
1515

1616
/// POST request reads endpoint.
17-
pub async fn reads<H: HtsGet + Send + Sync + 'static>(
17+
pub async fn reads<H: HtsGet + Clone + Send + Sync + 'static>(
1818
request: Query<HashMap<String, String>>,
1919
path: Path<String>,
2020
headers: HeaderMap,
@@ -27,7 +27,7 @@ pub async fn reads<H: HtsGet + Send + Sync + 'static>(
2727
}
2828

2929
/// POST request variants endpoint.
30-
pub async fn variants<H: HtsGet + Send + Sync + 'static>(
30+
pub async fn variants<H: HtsGet + Clone + Send + Sync + 'static>(
3131
request: Query<HashMap<String, String>>,
3232
path: Path<String>,
3333
headers: HeaderMap,

0 commit comments

Comments
 (0)