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

feature: NFS function to access dynamic file size while open for write #719

Open
theWebalyst opened this Issue Dec 21, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@theWebalyst
Copy link

theWebalyst commented Dec 21, 2018

This is a feature request on the SAFE NFS emulation API.

When a file is opened for read the file size is accessible using File.size()

When a file is opened for write and only write File.size() returns an error, but if open for read and write this will return the original size.

Suggested feature: add a method File.size_written() that returns the current size of a file that is open for write and/or read. I'm not sure if it should return zero or an error if the file is only open for read, but probably an error if the reason can be indicated.

This issue is raised as a result of the dev forum discussion here.

@theWebalyst

This comment has been minimized.

Copy link

theWebalyst commented Dec 21, 2018

Another thing to consider which might affect implementation of this feature is whether to disallow a file being opened for both read and write simultaneously:

"Thinking about this more, I wonder if this should even be allowed. It seems counterintuitive; a file opened for reading and writing will return a single file handle, but the Reader and Writer can have completely different contents. So you’d be using the same file handle for two different purposes which can be confusing and error-prone."

"There is also no performance benefit to simultaneous read/write since it’s basically two separate fetches in one call to file.open(). I think it would be better if we disallow opening a file for both read/write (make it an error case) and instead encourage two separate calls to file.open(). Then we can make file.size() work for files in write mode. Would like to hear what others think" - @m-cat (ref)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment