Skip to content

Commit

Permalink
Update and prune some dependencies (#731)
Browse files Browse the repository at this point in the history
* Update dependencies to remove some duplicate versions

Signed-off-by: James Bornholt <[email protected]>

* Sort cargo dependencies (no actual changes)

Signed-off-by: James Bornholt <[email protected]>

* Remove fs2 dependency

It's old and unmaintained, and nix has a statvfs implementation. The only trick
is that nix makes us do the block-size calculation ourselves, but since we only
care about the ratio of free blocks, we actually don't need the block size at all.

Signed-off-by: James Bornholt <[email protected]>

* Cleanup some default dependency features

A few features we either weren't using at all, or were only using in tests
and so can remove from the release build.

Signed-off-by: James Bornholt <[email protected]>

---------

Signed-off-by: James Bornholt <[email protected]>
  • Loading branch information
jamesbornholt authored Feb 5, 2024
1 parent 778aad3 commit 4eba52d
Show file tree
Hide file tree
Showing 8 changed files with 197 additions and 507 deletions.
589 changes: 139 additions & 450 deletions Cargo.lock

Large diffs are not rendered by default.

33 changes: 16 additions & 17 deletions mountpoint-s3-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,43 @@ description = "High-performance Amazon S3 client for Mountpoint for Amazon S3."
mountpoint-s3-crt = { path = "../mountpoint-s3-crt", version = "0.6.0" }

async-trait = "0.1.57"
auto_impl = "1.0.1"
auto_impl = "1.1.2"
base64ct = { version = "1.6.0", features = ["std"] }
const_format = "0.2.30"
futures = { version = "0.3.24", features = ["thread-pool"] }
futures = "0.3.24"
lazy_static = "1.4.0"
libc = "0.2.126"
libc-stdhandle = "0.1.0"
md-5 = "0.10.5"
metrics = "0.20.1"
metrics = "0.21.1"
once_cell = "1.16.0"
percent-encoding = "2.2.0"
pin-project = "1.0.12"
platform-info = "2.0.2"
regex = "1.7.1"
serde_json = "1.0.104"
static_assertions = "1.1.0"
thiserror = "1.0.34"
time = { version = "0.3.17", features = ["formatting", "parsing"] }
tracing = { version = "0.1.35", default-features = false, features = ["std", "log"] }
xmltree = "0.10.3"
serde_json = "1.0.104"

# Dependencies for the mock client only
async-io = { version = "2.3.1", optional = true }
async-lock = { version = "2.6.0", optional = true }
async-lock = { version = "3.3.0", optional = true }
md-5 = { version = "0.10.5", optional = true }
rand = { version = "0.8.5", optional = true }
rand_chacha = { version = "0.3.1", optional = true }

[dev-dependencies]
anyhow = { version = "1.0.64", features = ["backtrace"] }
aws-config = "0.56.0"
aws-credential-types = "0.56.0"
aws-sdk-s3 = "0.29.0"
aws-sdk-sts = "0.29.0"
aws-sdk-s3 = "0.30.0"
aws-sdk-sts = "0.30.0"
aws-smithy-runtime-api = "0.56.1"
bytes = "1.2.1"
clap = { version = "4.1.9", features = ["derive"] }
ctor = "0.1.23"
proptest = "1.0.0"
ctor = "0.2.6"
proptest = "1.4.0"
rusty-fork = "0.3.0"
tempfile = "3.5.0"
test-case = "2.2.2"
Expand All @@ -61,18 +60,18 @@ tracing-subscriber = { version = "0.3.14", features = ["fmt", "env-filter"] }
mountpoint-s3-client = { path = ".", features = ["mock"] }

[build-dependencies]
built = { version = "0.6.0", features = ["git2"] }

[lib]
doctest = false
built = { version = "0.7.1", features = ["git2"] }

[features]
mock = ["dep:async-io", "dep:async-lock", "dep:rand", "dep:rand_chacha"]
# Test features
mock = ["dep:async-io", "dep:async-lock", "dep:md-5", "dep:rand", "dep:rand_chacha"]
# Features for choosing tests
s3_tests = []
fips_tests = []
s3express_tests = []

[lib]
doctest = false

# Make async trait docs not-ugly on docs.rs (https://github.com/dtolnay/async-trait/issues/213)
[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docs_rs"]
7 changes: 4 additions & 3 deletions mountpoint-s3-client/src/object_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ use std::{
use thiserror::Error;
use time::OffsetDateTime;

use md5::{Digest, Md5};

/// A single element of a [`get_object`](ObjectClient::get_object) response stream is a pair of
/// offset within the object and the bytes starting at that offset.
pub type GetBodyPart = (u64, Box<[u8]>);
Expand Down Expand Up @@ -42,8 +40,11 @@ impl ETag {

/// Creating unique etag from bytes
#[doc(hidden)]
#[cfg(feature = "mock")]
pub fn from_object_bytes(data: &[u8]) -> Self {
let mut hasher = Md5::new();
use md5::Digest as _;

let mut hasher = md5::Md5::new();
hasher.update(data);

let hash = hasher.finalize();
Expand Down
2 changes: 1 addition & 1 deletion mountpoint-s3-crt-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ bindgen = { version = "0.66.1", default-features = false, features = ["runtime"]
cc = "1.0.73"
cmake = "0.1.48"
rustflags = "0.1.1"
which = "4.3.0"
which = "6.0.0"

[dependencies]
libc = "0.2.126"
Expand Down
4 changes: 2 additions & 2 deletions mountpoint-s3-crt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description = "Rust interface to the AWS Common Runtime for Mountpoint for Amazo
[dependencies]
mountpoint-s3-crt-sys = { path = "../mountpoint-s3-crt-sys", version = "0.5.3" }

async-channel = "1.8.0"
async-channel = "2.1.1"
futures = "0.3.24"
libc = "0.2.132"
log = "0.4.17"
Expand All @@ -20,7 +20,7 @@ thiserror = "1.0.35"

[dev-dependencies]
criterion = "0.5.1"
ctor = "0.1.23"
ctor = "0.2.6"
futures-timer = "3.0.2"
rand = { version = "0.8.5", features = ["small_rng"] }
tempfile = "3.4.0"
Expand Down
59 changes: 30 additions & 29 deletions mountpoint-s3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,76 +11,77 @@ mountpoint-s3-client = { path = "../mountpoint-s3-client", version = "0.6.2" }
mountpoint-s3-crt = { path = "../mountpoint-s3-crt", version = "0.6.0" }

anyhow = { version = "1.0.64", features = ["backtrace"] }
async-channel = "1.8.0"
async-lock = "2.6.0"
async-channel = "2.1.1"
async-lock = "3.3.0"
async-trait = "0.1.57"
bincode = "1.3.3"
bytes = { version = "1.2.1", features = ["serde"] }
clap = { version = "4.1.9", features = ["derive"] }
const_format = "0.2.30"
crc32c = "0.6.3"
ctrlc = { version = "3.2.3", features = ["termination"] }
dashmap = "5.5.0"
futures = "0.3.24"
hdrhistogram = { version = "7.5.2", default-features = false }
hex = "0.4.3"
lazy_static = "1.4.0"
libc = "0.2.126"
metrics = "0.20.1"
linked-hash-map = "0.5.6"
metrics = "0.21.1"
nix = { version = "0.27.1", features = ["user"] }
regex = "1.7.1"
serde = { version = "1.0.190", features = ["derive"] }
serde_json = "1.0.95"
sha2 = "0.10.6"
supports-color = "2.0.0"
syslog = "6.1.0"
thiserror = "1.0.34"
tracing = { version = "0.1.35", default-features = false, features = ["std", "log", "attributes"] }
tracing-log = "0.1.3"
tracing-subscriber = { version = "0.3.14", features = ["fmt", "env-filter"] }
nix = "0.26.2"
time = { version = "0.3.17", features = ["macros", "formatting"] }
const_format = "0.2.30"
serde_json = "1.0.95"
serde = { version = "1.0.190", features = ["derive"] }
bincode = "1.3.3"
sha2 = "0.10.6"
hex = "0.4.3"
linked-hash-map = "0.5.6"
fs2 = "0.4.3"
tracing = { version = "0.1.35", features = ["log"] }
tracing-log = "0.2.0"
tracing-subscriber = { version = "0.3.14", features = ["env-filter"] }

[target.'cfg(target_os = "linux")'.dependencies]
procfs = { version = "0.15.1", default-features = false }
procfs = { version = "0.16.0", default-features = false }

[dev-dependencies]
mountpoint-s3-client = { path = "../mountpoint-s3-client", features = ["mock"] }

assert_cmd = "2.0.6"
assert_fs = "1.0.9"
assert_fs = "1.1.1"
aws-config = "0.56.0"
aws-sdk-s3 = "0.29.0"
aws-sdk-sts = "0.29.0"
aws-sdk-s3 = "0.30.0"
aws-sdk-sts = "0.30.0"
base16ct = { version = "0.1.1", features = ["alloc"] }
ctor = "0.1.23"
ctor = "0.2.6"
filetime = "0.2.21"
predicates = "2.1.2"
proptest = "1.0.0"
proptest-derive = "0.3.0"
futures = { version = "*", features = ["thread-pool"] }
predicates = "3.1.0"
proptest = "1.4.0"
proptest-derive = "0.4.0"
rand = "0.8.5"
rand_chacha = "0.3.1"
rusty-fork = "0.3.0"
serial_test = "2.0.0"
sha2 = "0.10.6"
shuttle = { version = "0.5.0" }
tempfile = "3.4.0"
test-case = "2.2.2"
tokio = { version = "1.24.2", features = ["rt", "macros"] }
walkdir = "2.3.3"
rusty-fork = "0.3.0"

[build-dependencies]
built = { version = "0.7.1", features = ["git2"] }

[features]
# Test features
# Unreleased feature flags
sse_kms = []
# Features for choosing tests
fips_tests = []
fuse_tests = []
s3_tests = []
s3express_tests = []
shuttle = []
sse_kms = []

[build-dependencies]
built = { version = "0.6.0", features = ["git2"] }

[[bin]]
name = "mount-s3"
Expand Down
2 changes: 1 addition & 1 deletion mountpoint-s3/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ fn validate_mount_point(path: impl AsRef<Path>) -> anyhow::Result<()> {
}
};

if mounts.iter().any(|mount| mount.mount_point == path.as_ref()) {
if mounts.0.iter().any(|mount| mount.mount_point == path.as_ref()) {
return Err(anyhow!("mount point {} is already mounted", path.as_ref().display()));
}
}
Expand Down
8 changes: 4 additions & 4 deletions mountpoint-s3/src/data_cache/disk_data_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ impl DiskDataCache {
CacheLimit::Unbounded => false,
CacheLimit::TotalSize { max_size } => size > max_size,
CacheLimit::AvailableSpace { min_ratio } => {
let stats = match fs2::statvfs(&self.cache_directory) {
Ok(stats) if stats.total_space() == 0 => {
warn!("unable to determine available space");
let stats = match nix::sys::statvfs::statvfs(&self.cache_directory) {
Ok(stats) if stats.blocks() == 0 => {
warn!("unable to determine available space (0 blocks reported)");
return false;
}
Ok(stats) => stats,
Expand All @@ -313,7 +313,7 @@ impl DiskDataCache {
return false;
}
};
(stats.available_space() as f64) < min_ratio * (stats.total_space() as f64)
(stats.blocks_free() as f64) < min_ratio * (stats.blocks() as f64)
}
}
}
Expand Down

0 comments on commit 4eba52d

Please sign in to comment.