Documentation
¶
Index ¶
- Constants
- type File
- func (f *File) Lock(exclusive, blocking bool) error
- func (f *File) MMap(sz int) ([]byte, error)
- func (f *File) MUnmap(b []byte) error
- func (f *File) Size() (int64, error)
- func (f *File) Stat() (os.FileInfo, error)
- func (f *File) Sync(flags vfs.SyncFlag) error
- func (f *File) Truncate(sz int64) error
- func (f *File) Unlock() error
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
File implements vfs.File for the current target operating system.
func (*File) Sync ¶
Sync uses FlushFileBuffers to flush all file buffers to disk. For more information about the operation executed check the FlushFileBuffers API docs1.
Depending on Windows+driver versions or system wide settings, FlushFileBuffers might not be reliable. While FlushFileBuffers flushes the OS disk cache, we require a FLUSH_CACHE to be executed and honored by the driver and the device. Otherwise we might suffer data loss and file corruption. Also see 2 and 3.
Enabling write caching on the disk 4 can disable the FLUSH_CACHE command, potentially leading to data loss and file corruption if the disk looses power.
Check 5, for why we don't want to use write through.