-
Notifications
You must be signed in to change notification settings - Fork 626
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
NIOFileSystem: Provide API to set last-modified timestamp (ie: "touch") #2712
Comments
Thanks for opening this up. Going to tag @glbrntt here since he build most of the |
Thanks for opening this issue, I think this is a reasonable API to add. We likely want to add a new API to the From that base API we can then extend |
This PR adds API to set a file's last accessed and last modified times, as well as a `touch()` shorthand that updates both to the current time. Motivation: Feature request: #2712 Modifications: This PR adds API to set a file's last accessed and last modified times, as well as a `touch()` shorthand that updates both to the current time. Result: Files' last accessed and last modified times can be updated.
Expected behavior
I can set the last-modified timestamp on a file via a simple
NIOFileSystem
API.Actual behavior
No APIs exist to set timestamps on files or perform a simple "touch".
I am not sure how much control over the various file timestamps one would realistically need, but I find that setting the current time as last-modified is a common thing on server systems.
My concrete use case was a tiny service that periodically checks local certificate files (for TLS), renews them if required, and triggers a "config-reload" of a long-running traefik instance. The simplest (maybe only?) way to tell traefik to hot-reload its certificates is by touching the config file.
I ended up sys-calling into
utime
myself, but it would be a great fit for the NIOFileSystem APIs.The text was updated successfully, but these errors were encountered: