Skip to content

Commit

Permalink
Merge pull request #7458 from rust-lang/renovate/object_store-0.x
Browse files Browse the repository at this point in the history
Update Rust crate object_store to v0.8.0
  • Loading branch information
Turbo87 authored Nov 7, 2023
2 parents 5c865ef + df6dc8e commit 3cbd5ee
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 47 deletions.
51 changes: 12 additions & 39 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ lettre = { version = "=0.11.1", default-features = false, features = ["file-tran
minijinja = "=1.0.9"
moka = { version = "=0.12.1", features = ["future"] }
oauth2 = { version = "=4.4.2", default-features = false, features = ["reqwest"] }
object_store = { version = "=0.7.1", features = ["aws"] }
object_store = { version = "=0.8.0", features = ["aws"] }
once_cell = "=1.18.0"
p256 = "=0.13.2"
parking_lot = "=0.12.1"
Expand Down
16 changes: 10 additions & 6 deletions src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,23 +253,27 @@ impl Storage {
#[instrument(skip(self, bytes))]
pub async fn upload_crate_file(&self, name: &str, version: &str, bytes: Bytes) -> Result<()> {
let path = crate_file_path(name, version);
self.crate_upload_store.put(&path, bytes).await
self.crate_upload_store.put(&path, bytes).await?;
Ok(())
}

#[instrument(skip(self, bytes))]
pub async fn upload_readme(&self, name: &str, version: &str, bytes: Bytes) -> Result<()> {
let path = readme_path(name, version);
self.readme_upload_store.put(&path, bytes).await
self.readme_upload_store.put(&path, bytes).await?;
Ok(())
}

#[instrument(skip(self, content))]
pub async fn sync_index(&self, name: &str, content: Option<String>) -> Result<()> {
let path = crates_io_index::Repository::relative_index_file_for_url(name).into();
if let Some(content) = content {
self.index_upload_store.put(&path, content.into()).await
self.index_upload_store.put(&path, content.into()).await?;
} else {
self.index_store.delete(&path).await
self.index_store.delete(&path).await?;
}

Ok(())
}

#[instrument(skip(self))]
Expand Down Expand Up @@ -302,7 +306,7 @@ impl Storage {
}

async fn delete_all_with_prefix(&self, prefix: &Path) -> Result<()> {
let objects = self.store.list(Some(prefix)).await?;
let objects = self.store.list(Some(prefix));
let locations = objects.map(|meta| meta.map(|m| m.location)).boxed();

self.store
Expand Down Expand Up @@ -378,7 +382,7 @@ mod tests {
}

pub async fn stored_files(store: &dyn ObjectStore) -> Vec<String> {
let stream = store.list(None).await.unwrap();
let stream = store.list(None);
let list = stream.try_collect::<Vec<_>>().await.unwrap();

list.into_iter()
Expand Down
2 changes: 1 addition & 1 deletion src/tests/util/test_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl TestApp {
.unwrap();

let list = rt.block_on(async {
let stream = store.list(None).await.unwrap();
let stream = store.list(None);
stream.try_collect::<Vec<_>>().await.unwrap()
});

Expand Down

0 comments on commit 3cbd5ee

Please sign in to comment.