Skip to content

Commit 6c8eddb

Browse files
authored
refactor!: migrate chrono to jiff (#6643)
Signed-off-by: tison <wander4096@gmail.com>
1 parent 8076331 commit 6c8eddb

File tree

82 files changed

+637
-474
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+637
-474
lines changed

bin/oay/Cargo.lock

Lines changed: 231 additions & 90 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/oay/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ frontends-webdav = [
4040
]
4141

4242
[dependencies]
43-
anyhow = "1"
44-
axum = "0.8"
45-
chrono = "0.4.31"
43+
anyhow = { version = "1.0.100" }
44+
axum = { version = "0.8.6" }
4645
dav-server = { version = "0.8", optional = true }
4746
dav-server-opendalfs = { version = "0.6.0", path = "../../integrations/dav-server", optional = true }
4847
futures-util = { version = "0.3.29", optional = true }
48+
jiff = { version = "0.2.15" }
4949
log = { version = "0.4.27" }
50-
logforth = { version = "0.27.0", default-features = false }
50+
logforth = { version = "0.28.1", features = ["starter-log"] }
5151
opendal = { version = "0.54.0", path = "../../core", features = [
5252
"services-fs",
5353
] }

bin/oay/src/bin/oay.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async fn main() -> Result<()> {
3434
}
3535

3636
async fn s3() -> Result<()> {
37-
logforth::stderr().apply();
37+
logforth::starter_log::stderr().apply();
3838

3939
let cfg: Config =
4040
toml::from_str(&std::fs::read_to_string("oay.toml").context("failed to open oay.toml")?)?;

bin/oay/src/bin/webdav.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use opendal::services::Fs;
2525

2626
#[tokio::main]
2727
async fn main() -> Result<()> {
28-
logforth::stderr().apply();
28+
logforth::starter_log::stderr().apply();
2929

3030
let cfg: Config = Config {
3131
backend: oay::BackendConfig {

bin/oay/src/services/s3/service.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use axum::http::StatusCode;
2424
use axum::response::IntoResponse;
2525
use axum::response::Response;
2626
use axum::routing::get;
27-
use chrono::SecondsFormat;
2827
use futures_util::StreamExt;
2928
use opendal::Operator;
3029
use serde::Deserialize;
@@ -117,10 +116,7 @@ async fn handle_list_objects(
117116
} else {
118117
contents.push(Object {
119118
key: v.path().to_string(),
120-
last_modified: meta
121-
.last_modified()
122-
.unwrap_or_default()
123-
.to_rfc3339_opts(SecondsFormat::Millis, true),
119+
last_modified: format!("{:.6}", meta.last_modified().unwrap_or_default()),
124120
etag: meta.etag().unwrap_or_default().to_string(),
125121
size: meta.content_length(),
126122
});

bin/oli/Cargo.lock

Lines changed: 52 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/oli/tests/integration/test_utils.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ pub const REPLACEMENTS: &[(&str, &str)] = &[
143143
r"(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{9} UTC)",
144144
"[TIMESTAMP]",
145145
),
146+
(
147+
r"(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{9}Z)",
148+
"[TIMESTAMP]",
149+
),
146150
];
147151
pub static REPLACEMENT_REGEXS: std::sync::LazyLock<Vec<(regex::Regex, String)>> =
148152
std::sync::LazyLock::new(|| {

bindings/c/src/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl opendal_metadata {
131131
let mtime = self.deref().last_modified();
132132
match mtime {
133133
None => -1,
134-
Some(time) => time.timestamp_millis(),
134+
Some(time) => time.as_millisecond(),
135135
}
136136
}
137137
}

bindings/cpp/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ rust-version = "1.85"
3030
crate-type = ["staticlib"]
3131

3232
[dependencies]
33-
anyhow = "1.0"
34-
chrono = "0.4"
35-
cxx = "1.0"
33+
anyhow = { version = "1.0.100" }
34+
cxx = { version = "1.0.186" }
3635
cxx-async = { version = "0.1.3", optional = true }
37-
futures = "0.3"
36+
futures = { version = "0.3.31" }
37+
jiff = { version = "0.2.15" }
3838
# this crate won't be published, we always use the local version
3939
opendal = { version = ">=0", path = "../../core", features = ["blocking"] }
4040
tokio = { version = "1.27", features = ["fs", "macros", "rt-multi-thread"] }
4141

4242
[build-dependencies]
43-
cxx-build = "1.0"
43+
cxx-build = { version = "1.0.186" }
4444

4545
[features]
4646
async = ["cxx-async", "cxx/c++20"]

bindings/cpp/src/types.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ impl From<od::Metadata> for ffi::Metadata {
2929
let content_type = meta.content_type().map(ToOwned::to_owned).into();
3030
let content_encoding = meta.content_encoding().map(ToOwned::to_owned).into();
3131
let etag = meta.etag().map(ToOwned::to_owned).into();
32-
let last_modified = meta
33-
.last_modified()
34-
.map(|time| time.to_rfc3339_opts(chrono::SecondsFormat::Nanos, false))
35-
.into();
32+
let last_modified = meta.last_modified().map(|time| time.to_string()).into();
3633
let version = meta.version().map(ToOwned::to_owned).into();
3734
let is_current = meta.is_current().into();
3835
let is_deleted = meta.is_deleted();

0 commit comments

Comments
 (0)