Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
PhotonQuantum committed Sep 27, 2023
1 parent 60a88ad commit b2b7fc8
Show file tree
Hide file tree
Showing 11 changed files with 265 additions and 361 deletions.
583 changes: 241 additions & 342 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion rsync-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ eyre = "0.6"
futures = "0.3"
itertools = { version = "0.11", optional = true }
metrics-tracing-context = { version = "0.14", optional = true }
opendal = { version = "0.39", default-features = false, features = ["rustls", "services-s3", "layers-tracing"], optional = true }
opendal = { version = "0.40", default-features = false, features = ["rustls", "services-s3", "layers-tracing"], optional = true }
percent-encoding = { version = "2.2", optional = true }
proptest = { version = "1.2", optional = true }
proptest-derive = { version = "0.4", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion rsync-fetcher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ itertools = "0.11"
md4 = "0.10"
multiversion = "0.7"
num = "0.4"
opendal = { version = "0.39", default-features = false }
opendal = { version = "0.40", default-features = false }
percent-encoding = "2.2"
rsync-core = { path = "../rsync-core", features = ["s3", "percent-encoding", "pg"] }
scan_fmt = "0.2"
Expand Down
2 changes: 1 addition & 1 deletion rsync-fetcher/src/pg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ mod tests {
(b"d/f", Some(6)),
(b"d/f/g", Some(7)),
];
for (filename, expected_parent) in expect_entries.iter() {
for (filename, expected_parent) in expect_entries {
let actual = sqlx::query!(
r#"
SELECT parent FROM objects WHERE revision = $1 AND filename = $2
Expand Down
6 changes: 2 additions & 4 deletions rsync-fetcher/src/rsync/uploader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,18 @@ impl Uploader {
let encoded_name = percent_encoding::percent_encode(filename, ATTR_CHAR);
format!("attachment; filename=\"{encoded_name}\"; filename*=UTF-8''{encoded_name}")
});
let file_size = target_file.metadata().await?.len();

let mut writer = content_disposition
.map_or_else(
|| self.s3.writer_with(&key).content_length(file_size),
|| self.s3.writer_with(&key),
|content_disposition| {
self.s3
.writer_with(&key)
.content_length(file_size)
.content_disposition(&content_disposition)
},
)
.await?;
writer.copy(file_size, target_file.compat()).await?;
writer.copy(target_file.compat()).await?;
writer.close().await?;
}
Ok(())
Expand Down
6 changes: 3 additions & 3 deletions rsync-gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ metrics = "0.21"
metrics-exporter-prometheus = "0.12"
metrics-tracing-context = "0.14"
metrics-util = "0.15"
moka = { version = "0.11", features = ["future"] }
opendal = { version = "0.39", default-features = false, features = ["layers-metrics"] }
moka = { version = "0.12", features = ["future"] }
opendal = { version = "0.40", default-features = false, features = ["layers-metrics"] }
percent-encoding = "2.2"
rkyv = "0.7"
rsync-core = { path = "../rsync-core", features = ["percent-encoding", "pg", "s3", "metrics-tracing-context"] }
Expand Down Expand Up @@ -59,5 +59,5 @@ rstest = "0.18"
rsync-core = { path = "../rsync-core", features = ["tests"] }
test-strategy = "0.3"
time = "0.3"
toml = "0.7"
toml = "0.8"
uuid = { version = "1.4", features = ["arbitrary"] }
6 changes: 3 additions & 3 deletions rsync-gateway/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl NSCacheInner {
let started = Instant::now();

// Fast path: already exists in L1 cache
if let Some(resolved) = self.l1.get(key) {
if let Some(resolved) = self.l1.get(key).await {
let elapsed = started.elapsed();
histogram!(HISTOGRAM_L1_QUERY_TIME, elapsed.as_millis() as f64);
increment_counter!(COUNTER_L1_HIT);
Expand All @@ -141,7 +141,7 @@ impl NSCacheInner {

// Now there might be multiple threads trying to get_or_insert the same key.
// We'll deal with this later. No calculation done yet.
let init = self.l2.get(key).map_or_else(
let init = self.l2.get(key).await.map_or_else(
|| {
increment_counter!(COUNTER_MISS);
init.map_ok(|resolved| {
Expand Down Expand Up @@ -324,9 +324,9 @@ impl Expiry<Vec<u8>, Arc<MaybeCompressed>> for ExpiryPolicy {
mod tests {
#![allow(clippy::explicit_deref_methods)]

use bytesize::ByteSize;
use std::future::ready;

use bytesize::ByteSize;
use eyre::eyre;
use proptest::strategy::{Just, Strategy};
use proptest::{prop_assert_eq, prop_assume, prop_oneof};
Expand Down
5 changes: 3 additions & 2 deletions rsync-gateway/src/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ use std::time::Instant;
use eyre::{bail, Report, Result};
use futures::future::BoxFuture;
use futures::TryStreamExt;
use rsync_core::utils::AbortJoinHandle;
use scopeguard::defer;
use serde::Deserialize;
use sqlx::postgres::PgListener;
use sqlx::PgPool;
use tokio::sync::RwLock;

use tracing::{debug, error};

use rsync_core::utils::AbortJoinHandle;

#[derive(Debug, Clone, Deserialize)]
pub struct RevisionsChangeEvent {
pub revision: i32,
Expand Down Expand Up @@ -93,6 +93,7 @@ impl RevisionsChangeListenerInner {
let mut conn = PgListener::connect_with(pool).await?;
conn.listen("revisions_change").await?;
let stream = conn.into_stream();
#[allow(clippy::significant_drop_tightening)] // false positive
stream
.map_err(Report::from)
.try_for_each_concurrent(None, |notification| async move {
Expand Down
7 changes: 7 additions & 0 deletions rsync-gateway/src/render.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//! Rendering logic for the HTTP server.
//!
//! This module is responsible for rendering the resolved result into a HTTP response.
//!
//! TODO: too many arguments, consider grouping them into a struct.

use std::iter;
use std::time::Duration;

Expand Down Expand Up @@ -373,6 +379,7 @@ mod tests {
}
}

#[allow(clippy::arc_with_non_send_sync)] // macro generated code
fn resolved_non_regular_strategy() -> impl Strategy<Value = Resolved> {
prop_oneof![
Vec::<ListingEntry>::arbitrary().prop_map(|entries| Resolved::Directory { entries }),
Expand Down
5 changes: 2 additions & 3 deletions rsync-gateway/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ prop_compose! {
let date = NaiveDate::from_yo_opt(year, u32::from(ord)).expect("valid date");
let time = NaiveTime::from_num_seconds_from_midnight_opt(secs, nano).expect("valid time");
let dt = NaiveDateTime::new(date, time);
DateTime::from_utc(dt, Utc)
DateTime::from_naive_utc_and_offset(dt, Utc)
}
}

Expand Down Expand Up @@ -91,12 +91,11 @@ mod db_required {
type BlockingWriter = ();
type Pager = ();
type BlockingPager = ();
type Appender = ();

fn info(&self) -> AccessorInfo {
let mut am = AccessorInfo::default();
am.set_scheme(MOCK_PRESIGN_SCHEME)
.set_capability(Capability {
.set_native_capability(Capability {
presign: true,
presign_write: true,
..Default::default()
Expand Down
2 changes: 1 addition & 1 deletion rsync-gc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ eyre = "0.6"
futures = "0.3"
indicatif = "0.17"
itertools = "0.11"
opendal = { version = "0.39", default-features = false }
opendal = { version = "0.40", default-features = false }
rsync-core = { path = "../rsync-core", features = ["s3", "pg"] }
sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "postgres", "macros"] }
tokio = { version = "1.25", features = ["full"] }
Expand Down

0 comments on commit b2b7fc8

Please sign in to comment.