-
Notifications
You must be signed in to change notification settings - Fork 44
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
feat: allow vfs implementations to specify m/b/a-times in file metadata #63
Conversation
Nooo i forgot to run cargo fmt |
Hi, thanks for the PR! Definitely useful! |
Good Idea! I don't know if we should necessarily expect ModifyTimes to update when we write to a file - maybe that isnt guaranteed on all operating systems...
I just looked into it, and realized the trait definition immutably borrows the Filesystem |
Build looks good now 👍 Yeah, a lot of systems also mount with It might make sense to have a way to modify these times as well, that would certainly make testing easier. Regarding the MemoryFS implementation, I think this should work without refcell. |
The diff has grown 😯 I've added your suggestions to the non-async version
|
i could certaily do the work to implement this in async too sometime... |
I have added the neccesary tests to async_vfs However i have not been able to find a function in async_std that works like the new So the tests right now are all passing, because they recieve VfsErrorKind::NotSupported |
Thanks for the updates! I will take a closer look later this week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, some small suggestions.
The merge conflicts with master only touch the imports and should be fairly simple to resolve.
If you have any questions, let me know!
Feel free to resolve the threads that i have fixed. |
Merged! Thanks again for the great work, especially getting all the finer details sorted out 👍 |
This small change adds the file modification birth and access times to the VfsMetadata struct.
These times are encapsulated in
Option<>
, as they are not guaranteed to be available even instd::fs::metadata
.I have implemented the metadata timestamps for PhysicalFS, though it may be possible to support them for the in memory database as well.
Motivation
I am planning on writing a minimal vfs implementation for MTS (Media Transfer Protocol).
I don't know yet if this is going to work, especially since there are few crates for MTS - but maybe i can make it work.
In the final product i will need access to the mtime field.