Skip to content

Commit

Permalink
feat: implement Mirror middleware and OCI middleware work
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Mar 8, 2024
1 parent c80ee27 commit 9bded38
Show file tree
Hide file tree
Showing 5 changed files with 475 additions and 4 deletions.
10 changes: 10 additions & 0 deletions crates/rattler/src/package_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ pub struct CacheKey {
name: String,
version: String,
build_string: String,
sha256: Option<String>,
}

impl CacheKey {
/// Return the sha256 hash of the package if it is known.
pub fn sha256(&self) -> Option<&str> {
self.sha256.as_deref()
}
}

impl From<ArchiveIdentifier> for CacheKey {
Expand All @@ -46,6 +54,7 @@ impl From<ArchiveIdentifier> for CacheKey {
name: pkg.name,
version: pkg.version,
build_string: pkg.build_string,
sha256: None,
}
}
}
Expand All @@ -56,6 +65,7 @@ impl From<&PackageRecord> for CacheKey {
name: record.name.as_normalized().to_string(),
version: record.version.to_string(),
build_string: record.build.clone(),
sha256: record.sha256.map(|s| format!("{s:x}")).clone(),
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions crates/rattler_networking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ license.workspace = true
readme.workspace = true

[features]
default = ["rustls-tls"]
native-tls = ['reqwest/native-tls']
rustls-tls = ['reqwest/rustls-tls']

Expand All @@ -20,6 +21,7 @@ async-trait = { workspace = true }
base64 = { workspace = true }
dirs = { workspace = true }
fslock = { workspace = true }
http = "0.2"
itertools = { workspace = true }
keyring = { workspace = true }
lazy_static = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion crates/rattler_networking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

//! Networking utilities for Rattler, specifically authenticating requests
pub use authentication_middleware::AuthenticationMiddleware;

pub use authentication_storage::{authentication::Authentication, storage::AuthenticationStorage};
pub use mirror_middleware::{MirrorMiddleware, OciMiddleware};

pub mod authentication_middleware;
pub mod authentication_storage;
pub mod mirror_middleware;
pub mod retry_policies;

mod redaction;
Expand Down
Loading

0 comments on commit 9bded38

Please sign in to comment.