Skip to content

Commit

Permalink
feat: Bump opendal to 0.48.0
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <github@xuanwo.io>
  • Loading branch information
Xuanwo committed Aug 2, 2024
1 parent 29d17c7 commit d88eebb
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 159 deletions.
126 changes: 45 additions & 81 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ mime = "0.3"
num_cpus = "1.16"
number_prefix = "0.4"
once_cell = "1.19"
opendal = { version = "0.47.3", optional = true, default-features = false }
opendal = { version = "0.48.0", optional = true, default-features = false }
openssl = { version = "0.10.64", optional = true }
rand = "0.8.4"
regex = "1.10.3"
reqsign = { version = "0.15.2", optional = true }
reqsign = { version = "0.16.0", optional = true }
reqwest = { version = "0.12", features = [
"json",
"blocking",
Expand Down
6 changes: 3 additions & 3 deletions src/cache/azure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ pub struct AzureBlobCache;

impl AzureBlobCache {
pub fn build(connection_string: &str, container: &str, key_prefix: &str) -> Result<Operator> {
let mut builder = Azblob::from_connection_string(connection_string)?;
builder.container(container);
builder.root(key_prefix);
let builder = Azblob::from_connection_string(connection_string)?
.container(container)
.root(key_prefix);

let op = Operator::new(builder)?
.layer(LoggingLayer::default())
Expand Down
14 changes: 7 additions & 7 deletions src/cache/gcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,24 @@ impl GCSCache {
rw_mode: CacheMode,
credential_url: Option<&str>,
) -> Result<Operator> {
let mut builder = Gcs::default();
builder.bucket(bucket);
builder.root(key_prefix);
builder.scope(rw_to_scope(rw_mode));
let mut builder = Gcs::default()
.bucket(bucket)
.root(key_prefix)
.scope(rw_to_scope(rw_mode));

if let Some(service_account) = service_account {
builder.service_account(service_account);
builder = builder.service_account(service_account);
}

if let Some(path) = cred_path {
builder.credential_path(path);
builder = builder.credential_path(path);
}

if let Some(cred_url) = credential_url {
let _ = Url::parse(cred_url)
.map_err(|err| anyhow!("gcs credential url is invalid: {err:?}"))?;

builder.customed_token_loader(Box::new(TaskClusterTokenLoader {
builder = builder.customized_token_loader(Box::new(TaskClusterTokenLoader {
scope: rw_to_scope(rw_mode).to_string(),
url: cred_url.to_string(),
}));
Expand Down
22 changes: 11 additions & 11 deletions src/cache/gha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ pub struct GHACache;

impl GHACache {
pub fn build(version: &str) -> Result<Operator> {
let mut builder = Ghac::default();
// This is the prefix of gha cache.
// From user side, cache key will be like `sccache/f/c/b/fcbxxx`
//
// User customization is theoretically supported, but I decided
// to see the community feedback first.
builder.root("/sccache");
let mut builder = Ghac::default()
// This is the prefix of gha cache.
// From user side, cache key will be like `sccache/f/c/b/fcbxxx`
//
// User customization is theoretically supported, but I decided
// to see the community feedback first.
.root("/sccache");

if version.is_empty() {
builder.version(&format!("sccache-v{VERSION}"));
builder = if version.is_empty() {
builder.version(&format!("sccache-v{VERSION}"))
} else {
builder.version(&format!("sccache-v{VERSION}-{version}"));
}
builder.version(&format!("sccache-v{VERSION}-{version}"))
};

let op = Operator::new(builder)?
.layer(LoggingLayer::default())
Expand Down
Loading

0 comments on commit d88eebb

Please sign in to comment.