Documentation
¶
Index ¶
Constants ¶
const MAP_POPULATE = 0x08000
const MaxSize = 0xFFFFFFFFFFFF // 256TB
MaxSize represents the largest supported mmap size.
Variables ¶
This section is empty.
Functions ¶
func Fdatasync ¶
Fdatasync triggers the fastest fsync-like operation that ensures durability of the data written to the given file and/or memory mapping.
Fdatasync might be faster than f.Sync() aka fsync thanks to not syncing metadata (last modification/access time) that isn't necessary to ensure durability of the data.
If mapping is provided, it's an mmap'ed slice corresponding to the given file, in case the operating system supports an alternative interface for syncing mmap'ed data.
WARNING: ERRORS RETURNED BY THIS FUNCTION ARE NOT RECOVERABLE. Many operating systems and file systems mark modified pages as clean in case of fsync failures, and there is no way to ensure data correctness after a failure. Moreover, the data in disk caches might not correspond to the data on disk, so whether the data appears corrupt upon reading back might not reflect whether the corruption actually exists on disk. The only sensible handling of fsync errors is to mark the database as corrupted and require manual inspection and recovery (including a reboot).
Types ¶
type Options ¶
type Options uint
const ( // Writable opens the file for writing (otherwise, it's opened read-only). Writable Options = 1 << 0 // SequentialAccess is a hint requesting aggressive read-ahead. // Incompatible with RandomAccess. Maps to MADV_SEQUENTIAL on Unix. SequentialAccess Options = 1 << 1 // RandomAccess is a hint that read ahead is less useful than normally. // Incompatible with SequentialAccess. Maps to MADV_RANDOM on Unix. RandomAccess Options = 1 << 2 // Prefault is a hint requesting the entire file to be loaded in memory // for fastest access. Maps to MAP_POPULATE on Linux. Prefault Options = 1 << 3 )