Documentation
¶
Overview ¶
This is library for the Go language to enable use of Direct IO under all supported OSes of Go.
Direct IO does IO to and from disk without buffering data in the OS. It is useful when you are reading or writing lots of data you don't want to fill the OS cache up with.
Instead of using os.OpenFile use directio.OpenFile
in, err := directio.OpenFile(file, os.O_RDONLY, 0666)
And when reading or writing blocks, make sure you do them in chunks of directio.BlockSize using memory allocated by directio.AlignedBlock
block := directio.AlignedBlock(BlockSize) _, err := io.ReadFull(in, block)
Index ¶
Constants ¶
View Source
const ( // Size to align the buffer to AlignSize = 4096 // Minimum block size BlockSize = 4096 )
Variables ¶
This section is empty.
Functions ¶
func AlignedBlock ¶
AlignedBlock returns []byte of size BlockSize aligned to a multiple of AlignSize in memory (must be power of two)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.