This issue is mostly for future reference.
Is your feature request related to a problem? Please describe.
Currently, tokio returns Rust std library Metadata for its filesystem methods (e.g. tokio::fs::metadata and tokio::fs::symlink_metadata). This makes it hard to enable io-uring on those methods because there's no supported methods in the Rust's Metadata struct to construct a Metadata given a statx entry/populated statx buffer.
However, in the future, when Metadata::from_statx (or an equivalent method) is merged in and stabilized, it should unblock supporting io-uring on tokio::fs::metadata and tokio::fs::symlink_metadata (and possibly many other tokio filesystem operations).
Describe the solution you'd like
Use Metadata::from_statx to construct Rust's Metadata type within Statx operation in tokio::fs. As a result, we then use the Rust std library Metadata methods to assist with supporting io-uring in many tokio filesystem operations.
Describe alternatives you've considered
For certain methods that rely on one of Metadata's accessor methods to to have io-uring support on that method, we can implement it an internal Metadata struct. This is what's done for tokio::fs::read, which required Metadata::len function. The only con in doing this though is that certain accessor methods might create tech debt or churn (e.g. Metadata::modified, Metadata::accessed, Metadata::created return a Result<SystemTime>, so we'd also need to implement a SystemTime wrapper). However, Metadata::is_dir, Metadata::is_file, and Metadata::is_symlink should be trivial to support. There doesn't seem to be an alternative to support io-uring on tokio::fs::metadata and tokio::fs::symlink_metadata directly (unless we create a tokio::fs::metadata2, but as discussed in the ACP made by Alice for Metadata::from_statx, this function wasn't desired).
This issue is mostly for future reference.
Is your feature request related to a problem? Please describe.
Currently, tokio returns Rust std library
Metadatafor its filesystem methods (e.g.tokio::fs::metadataandtokio::fs::symlink_metadata). This makes it hard to enable io-uring on those methods because there's no supported methods in the Rust's Metadata struct to construct a Metadata given a statx entry/populated statx buffer.However, in the future, when
Metadata::from_statx(or an equivalent method) is merged in and stabilized, it should unblock supporting io-uring ontokio::fs::metadataandtokio::fs::symlink_metadata(and possibly many other tokio filesystem operations).Describe the solution you'd like
Use
Metadata::from_statxto construct Rust'sMetadatatype withinStatxoperation intokio::fs. As a result, we then use the Rust std libraryMetadatamethods to assist with supporting io-uring in many tokio filesystem operations.Describe alternatives you've considered
For certain methods that rely on one of
Metadata's accessor methods to to have io-uring support on that method, we can implement it an internalMetadatastruct. This is what's done fortokio::fs::read, which requiredMetadata::lenfunction. The only con in doing this though is that certain accessor methods might create tech debt or churn (e.g.Metadata::modified,Metadata::accessed,Metadata::createdreturn aResult<SystemTime>, so we'd also need to implement aSystemTimewrapper). However,Metadata::is_dir,Metadata::is_file, andMetadata::is_symlinkshould be trivial to support. There doesn't seem to be an alternative to support io-uring ontokio::fs::metadataandtokio::fs::symlink_metadatadirectly (unless we create atokio::fs::metadata2, but as discussed in the ACP made by Alice forMetadata::from_statx, this function wasn't desired).