Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs: future proof File #2930

Merged
merged 3 commits into from Oct 9, 2020
Merged

fs: future proof File #2930

merged 3 commits into from Oct 9, 2020

Conversation

carllerche
Copy link
Member

Changes inherent methods to take &self instead of &mut self. This
brings the API in line with std.

This patch is implemented by using a tokio::sync::Mutex to guard the
internal File state. This is not an ideal implementation strategy
doesn't make a big impact compared to having to dispatch operations to a
background thread followed by a blocking syscall.

In the future, the implementation can be improved as we explore async
file-system APIs provided by the operating-system (iocp / io_uring).

A lot of the noise is due to enabling Mutex with the fs feature flag.

Closes #2927

Changes inherent methods to take `&self` instead of `&mut self`. This
brings the API in line with `std`.

This patch is implemented by using a `tokio::sync::Mutex` to guard the
internal `File` state. This is not an ideal implementation strategy
doesn't make a big impact compared to having to dispatch operations to a
background thread followed by a blocking syscall.

In the future, the implementation can be improved as we explore async
file-system APIs provided by the operating-system (iocp / io_uring).

Closes #2927
@taiki-e taiki-e added A-tokio Area: The main tokio crate M-fs Module: tokio/fs labels Oct 9, 2020
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-fs Module: tokio/fs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fs: switch to an intrusive waker style
4 participants