feat: disable Snafu futures feature (#2573)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/24376/head
Raphael Taylor-Davies 2021-09-19 12:36:24 +01:00 committed by GitHub
parent 3ffb16daa6
commit 4382bc0b71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 40 deletions

38
Cargo.lock generated
View File

@ -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",
]

View File

@ -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" ] }

View File

@ -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())

View File

@ -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())
}

View File

@ -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::<Vec<_>>()
})
.context(UnableToStreamListData {
bucket: &self.bucket_name,
.map_err(move |source| Error::UnableToStreamListData {
source,
bucket: bucket_name.clone(),
});
Ok(objects.boxed())