Skip to content
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

add options to disable zstd and bz2 #420

Merged
merged 4 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

#### Added

* Options to disable `bz2` and `zstd` in `fetch_repo_data`

## [0.13.0] - 2023-11-27

### 📃 Details
Expand Down
16 changes: 12 additions & 4 deletions crates/rattler_repodata_gateway/src/fetch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ pub struct FetchRepoDataOptions {

/// When enabled repodata can be fetched incrementally using JLAP
pub jlap_enabled: bool,

/// When enabled, the zstd variant will be used if available
pub zstd_enabled: bool,

/// When enabled, the bz2 variant will be used if available
pub bz2_enabled: bool,
}

impl Default for FetchRepoDataOptions {
Expand All @@ -170,6 +176,8 @@ impl Default for FetchRepoDataOptions {
cache_action: Default::default(),
variant: Variant::default(),
jlap_enabled: true,
zstd_enabled: true,
bz2_enabled: true,
}
}
}
Expand Down Expand Up @@ -400,13 +408,13 @@ pub async fn fetch_repo_data(

// Now that the caches have been refreshed determine whether or not we can use one of the
// variants. We don't check the expiration here since we just refreshed it.
let has_zst = variant_availability.has_zst();
let has_bz2 = variant_availability.has_bz2();
let has_jlap = variant_availability.has_jlap();
let has_zst = options.zstd_enabled && variant_availability.has_zst();
let has_bz2 = options.bz2_enabled && variant_availability.has_bz2();
let has_jlap = options.jlap_enabled && variant_availability.has_jlap();

// We first attempt to make a JLAP request; if it fails for any reason, we continue on with
// a normal request.
let jlap_state = if has_jlap && cache_state.is_some() && options.jlap_enabled {
let jlap_state = if has_jlap && cache_state.is_some() {
let repo_data_state = cache_state.as_ref().unwrap();
match jlap::patch_repo_data(
&client,
Expand Down