-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Dart:io feature request: Fsync and Fdatasync #8794
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
Comments
Windows have the system call FlushFileBuffers which is equivalent to fsync. There does not seem to be something that distinguishes fsync and fsyncdata on Windows. It would be possible to add methods sync() and syncSync() to RandomAccessFile. File.openWrite returns an IOSink so in that case IOSink should have a flush method returning a future. Finally the methods writeAsBytes, writeAsBytesSync, writeAsString, writeAsStringSync this would require an additional flag unless we always flush (they all use File.openWrite internally). |
For RandomAccessFile fsync was already available through the methods flush() and flushSync(). Proposed change for IOSink and related methods in https://codereview.chromium.org/20745006/. There will not be support for fdatasync. Added Started label. |
This comment was originally written by [email protected] Thanks for your continuing attention on this subject :) |
IOSink.flush added in https://code.google.com/p/dart/source/detail?r=29550 Added optional flush argument to some File methods in https://code.google.com/p/dart/source/detail?r=29880 Added Fixed label. |
Removed Area-IO label. |
This issue was originally filed by [email protected]
Hi,
I would like to have knowledge and control about whether file data and file metadata is sent to disk or not.
Like fsync and fdatasync on Linux.
This seems quite important to me for server systems.
If an operating system or filesystem does not support that control, than Dart should just ignore the fsync and fdatasync option.
Java NIO offers such control in the form of SYNC and DSYNC.
http://docs.oracle.com/javase/tutorial/essential/io/file.html
http://docs.oracle.com/javase/7/docs/api/java/nio/file/StandardOpenOption.html
And .net offers a similar control as well:
http://msdn.microsoft.com/en-us/library/2bw4h516%28v=VS.90%29.aspx
Best regards
The text was updated successfully, but these errors were encountered: