From 4382bc0b710e1d1d8d371c3cb524568b4bfa7f16 Mon Sep 17 00:00:00 2001 From: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com> Date: Sun, 19 Sep 2021 12:36:24 +0100 Subject: [PATCH] feat: disable Snafu futures feature (#2573) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- Cargo.lock | 38 ++++++++------------------------------ object_store/Cargo.toml | 2 +- object_store/src/aws.rs | 10 ++++++---- object_store/src/disk.rs | 7 +++++-- object_store/src/gcp.rs | 8 +++++--- 5 files changed, 25 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 202fb9a0ad..e3723f5715 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1284,7 +1284,7 @@ dependencies = [ "futures-sink", "futures-task", "futures-util", - "pin-project 1.0.8", + "pin-project", "pin-utils", ] @@ -2653,7 +2653,7 @@ dependencies = [ "js-sys", "lazy_static", "percent-encoding", - "pin-project 1.0.8", + "pin-project", "rand 0.8.4", "thiserror", "tokio", @@ -2972,33 +2972,13 @@ dependencies = [ "indexmap", ] -[[package]] -name = "pin-project" -version = "0.4.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "918192b5c59119d51e0cd221f4d49dde9112824ba717369e903c97d076083d0f" -dependencies = [ - "pin-project-internal 0.4.28", -] - [[package]] name = "pin-project" version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" dependencies = [ - "pin-project-internal 1.0.8", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be26700300be6d9d23264c73211d8190e755b6b5ca7a1b28230025511b52a5e" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "pin-project-internal", ] [[package]] @@ -4206,8 +4186,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eab12d3c261b2308b0d80c26fffb58d17eba81a4be97890101f416b478c79ca7" dependencies = [ "doc-comment", - "futures-core", - "pin-project 0.4.28", "snafu-derive", ] @@ -4752,7 +4730,7 @@ dependencies = [ "hyper", "hyper-timeout", "percent-encoding", - "pin-project 1.0.8", + "pin-project", "prost", "prost-derive", "tokio", @@ -4816,7 +4794,7 @@ dependencies = [ "futures-core", "futures-util", "indexmap", - "pin-project 1.0.8", + "pin-project", "rand 0.8.4", "slab", "tokio", @@ -4878,7 +4856,7 @@ dependencies = [ "metric", "observability_deps", "parking_lot", - "pin-project 1.0.8", + "pin-project", "snafu", "tower", "trace", @@ -4923,7 +4901,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ - "pin-project 1.0.8", + "pin-project", "tracing", ] @@ -4980,7 +4958,7 @@ dependencies = [ "metric", "observability_deps", "parking_lot", - "pin-project 1.0.8", + "pin-project", "tokio", "tokio-util", ] diff --git a/object_store/Cargo.toml b/object_store/Cargo.toml index b6ea8f8ea1..ada0a0c743 100644 --- a/object_store/Cargo.toml +++ b/object_store/Cargo.toml @@ -21,7 +21,7 @@ percent-encoding = "2.1" rusoto_core = { version = "0.47.0", optional = true} rusoto_credential = { version = "0.47.0", optional = true} rusoto_s3 = { version = "0.47.0", optional = true} -snafu = { version = "0.6.10", features = ["futures"] } +snafu = "0.6.10" tokio = { version = "1.11", features = ["macros", "fs"] } # Filesystem integration tokio-util = { version = "0.6.3", features = [ "io" ] } diff --git a/object_store/src/aws.rs b/object_store/src/aws.rs index 94d66986b7..5461e429bc 100644 --- a/object_store/src/aws.rs +++ b/object_store/src/aws.rs @@ -15,7 +15,7 @@ use futures::{ use rusoto_core::ByteStream; use rusoto_credential::{InstanceMetadataProvider, StaticProvider}; use rusoto_s3::S3; -use snafu::{futures::TryStreamExt as _, OptionExt, ResultExt, Snafu}; +use snafu::{OptionExt, ResultExt, Snafu}; use std::convert::TryFrom; use std::{fmt, io}; @@ -179,6 +179,7 @@ impl ObjectStoreApi for AmazonS3 { key: key.clone(), ..Default::default() }; + let bucket_name = self.bucket_name.clone(); Ok(self .client .get_object(get_request) @@ -192,9 +193,10 @@ impl ObjectStoreApi for AmazonS3 { bucket: self.bucket_name.to_owned(), location: key.clone(), })? - .context(UnableToGetPieceOfData { - bucket: self.bucket_name.to_owned(), - location: key, + .map_err(move |source| Error::UnableToGetPieceOfData { + source, + bucket: bucket_name.clone(), + location: key.clone(), }) .err_into() .boxed()) diff --git a/object_store/src/disk.rs b/object_store/src/disk.rs index 0cdf90e834..dbdb624a6b 100644 --- a/object_store/src/disk.rs +++ b/object_store/src/disk.rs @@ -9,7 +9,7 @@ use futures::{ stream::{self, BoxStream}, Stream, StreamExt, TryStreamExt, }; -use snafu::{ensure, futures::TryStreamExt as _, OptionExt, ResultExt, Snafu}; +use snafu::{ensure, OptionExt, ResultExt, Snafu}; use std::sync::Arc; use std::{collections::BTreeSet, convert::TryFrom, io, path::PathBuf}; use tokio::fs; @@ -135,7 +135,10 @@ impl ObjectStoreApi for File { let s = FramedRead::new(file, BytesCodec::new()) .map_ok(|b| b.freeze()) - .context(UnableToReadBytes { path }); + .map_err(move |source| Error::UnableToReadBytes { + source, + path: path.clone(), + }); Ok(s.boxed()) } diff --git a/object_store/src/gcp.rs b/object_store/src/gcp.rs index f5bc49385a..bc13c65d1e 100644 --- a/object_store/src/gcp.rs +++ b/object_store/src/gcp.rs @@ -8,7 +8,7 @@ use async_trait::async_trait; use bytes::Bytes; use cloud_storage::Client; use futures::{stream::BoxStream, Stream, StreamExt, TryStreamExt}; -use snafu::{ensure, futures::TryStreamExt as _, ResultExt, Snafu}; +use snafu::{ensure, ResultExt, Snafu}; use std::{convert::TryFrom, env, io}; /// A specialized `Result` for Google Cloud Storage object store-related errors @@ -181,6 +181,7 @@ impl ObjectStoreApi for GoogleCloudStorage { bucket: &self.bucket_name, })?; + let bucket_name = self.bucket_name.clone(); let objects = object_lists .map_ok(|list| { list.items @@ -188,8 +189,9 @@ impl ObjectStoreApi for GoogleCloudStorage { .map(|o| CloudPath::raw(o.name)) .collect::>() }) - .context(UnableToStreamListData { - bucket: &self.bucket_name, + .map_err(move |source| Error::UnableToStreamListData { + source, + bucket: bucket_name.clone(), }); Ok(objects.boxed())