Skip to content

Commit df6dc8e

Browse files
committed
object_store: Adjust to API changes
1 parent 13ff223 commit df6dc8e

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/storage.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,23 +253,27 @@ impl Storage {
253253
#[instrument(skip(self, bytes))]
254254
pub async fn upload_crate_file(&self, name: &str, version: &str, bytes: Bytes) -> Result<()> {
255255
let path = crate_file_path(name, version);
256-
self.crate_upload_store.put(&path, bytes).await
256+
self.crate_upload_store.put(&path, bytes).await?;
257+
Ok(())
257258
}
258259

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

265267
#[instrument(skip(self, content))]
266268
pub async fn sync_index(&self, name: &str, content: Option<String>) -> Result<()> {
267269
let path = crates_io_index::Repository::relative_index_file_for_url(name).into();
268270
if let Some(content) = content {
269-
self.index_upload_store.put(&path, content.into()).await
271+
self.index_upload_store.put(&path, content.into()).await?;
270272
} else {
271-
self.index_store.delete(&path).await
273+
self.index_store.delete(&path).await?;
272274
}
275+
276+
Ok(())
273277
}
274278

275279
#[instrument(skip(self))]
@@ -302,7 +306,7 @@ impl Storage {
302306
}
303307

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

308312
self.store
@@ -378,7 +382,7 @@ mod tests {
378382
}
379383

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

384388
list.into_iter()

src/tests/util/test_app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl TestApp {
154154
.unwrap();
155155

156156
let list = rt.block_on(async {
157-
let stream = store.list(None).await.unwrap();
157+
let stream = store.list(None);
158158
stream.try_collect::<Vec<_>>().await.unwrap()
159159
});
160160

0 commit comments

Comments
 (0)