dami0806 opened a new pull request, #6650:
URL: https://github.com/apache/opendal/pull/6650

   # Related Issue
   Closes #6647
   
   # Rationale
   This PR centralizes all date/time-related logic within OpenDAL. By 
introducing a new `Timestamp` wrapper in `core/src/raw/time.rs`, direct usage 
of `jiff::Timestamp` throughout the codebase is removed.
   
   **Key benefits:**
   - **Simplified API**: Provides convenience methods like `now()`, 
`from_millisecond()`, and `format_http_date()`.
   - **Consistent error handling**: Converts `jiff` errors into OpenDAL's 
`Error` type.
   - **Type safety**: Prevents external `jiff` types from leaking into the 
public API.
   - **Future-proof design**: Makes it easier to adapt to potential date/time 
library changes.
   
   ---
   
   # Changes included in this PR
   This PR consists of **8 commits**, clearly separated for easy review:
   
   ### 1. Add `Timestamp` wrapper (`time.rs`)
   - Introduced a new `Timestamp` wrapper around `jiff::Timestamp` in 
`core/src/raw/time.rs`.
   - Implemented conversion traits: `From`, `TryFrom`, `FromStr`.
   - Added formatting methods: `format_http_date`, `format_rfc3339`, 
`format_iso8601`.
   - Added helper constructors: `now`, `from_millisecond`, `from_second`.
   
   ### 2. Remove `jiff_util` module
   - Deleted the obsolete `core/src/raw/jiff_util.rs`.
   - Updated `core/src/raw/mod.rs` to expose the new `Timestamp` type.
   
   ### 3. Update raw layer utilities
   - Refactored `adapters`, `http_util`, and `ops` to use the `Timestamp` 
wrapper.
   
   ### 4. Update types layer
   - Updated `metadata`, `options`, and `operator` to use the `Timestamp` 
wrapper.
   
   ### 5. Migrate cloud storage services
   - Services: S3, GCS, Azure Blob/DLS/File, Tencent COS, Alibaba OSS, 
Backblaze B2, Aliyun Drive, Vercel Blob, Cloudflare KV.
   - Metadata parsing and formatting now use the `Timestamp` wrapper.
   
   ### 6. Migrate filesystem services
   - Services: Local FS, HDFS, HDFS Native, SFTP, WebHDFS, WebDAV, FTP, 
MonoioFS, Alluxio, CompFS.
   - Updated file metadata, system time conversions, and listers/writers to use 
`Timestamp`.
   
   ### 7. Migrate other services
   - Services: Dropbox, OneDrive, Google Drive, pCloud, GitHub, Hugging Face, 
Koofr, LakeFS, Seafile, Yandex Disk, UpYun, Swift, cacache, dashmap, mini_moka, 
DBFS.
   - Integrated the `Timestamp` wrapper.
   
   ### 8. Update `Cargo.lock`
   - Refreshed dependency lockfile to reflect the `Timestamp` migration.
   
   ---
   
   ### Helper function replacements
   Throughout the migration:
   - Replaced `parse_datetime_from_rfc3339()` → `str.parse::<Timestamp>()`.
   - Replaced `parse_datetime_from_timestamp_millis()` → 
`Timestamp::from_millisecond()`.
   - Replaced direct `jiff::Timestamp` usage → `Timestamp` wrapper.
   
   ---
   
   # Commit Summary
   | # | Commit ID | Description |
   |---|-----------|-------------|
   | 1 | f672ba0a | Add `Timestamp` wrapper (`time.rs`) |
   | 2 | d3e90f00 | Remove `jiff_util` module |
   | 3 | 9e045d4a | Update raw utilities |
   | 4 | 44267e25 | Update types layer |
   | 5 | 3b5a2f99 | Migrate cloud storage services |
   | 6 | c5242809 | Migrate filesystem services |
   | 7 | 8ebbb36a | Migrate other services |
   | 8 | 96407992 | Update `Cargo.lock` |
   
   ---
   
   # Local Verification
   - ✅ `cargo fmt --check`
   - ✅ `cargo check -p opendal --features="blocking"`
   - ✅ `cargo clippy -p opendal --features="blocking" -- -D warnings`
   - ✅ `cargo test -p opendal --features="blocking,services-s3,services-fs"` 
(All 319 tests passed)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to