Documentation ¶
Overview ¶
Package disk contains helpers to interact with the disk.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DropCaches ¶
DropCaches will write dirty pages to disk with 'sync' so that they are not available for freeing and thus helps drop_caches to free more memory from file system and IO operations. 'drop_caches' will clear clean page caches, dentries (directory caches), and inodes (file caches).
func Fill ¶
Fill creates a temporary file in a directory that fills the disk by allocating it, but without performing any actual IO to write the content.
Types ¶
type Refiller ¶
type Refiller struct {
// contains filtered or unexported fields
}
Refiller maintains the temporary fill file for you, so you can easily (re-)adjust the disk space.
func NewRefiller ¶
NewRefiller creates a new refiller. `dir` is the directory to put the temporary file in.
Example:
refiller := NewRefiller(...) defer func() { if err := refiller.Close(); err != nil { s.Error(...) } }() refiller.RefillUntil(...) ... refiller.RefillUntil(...) ...
func (*Refiller) Close ¶
Close removes the temporary file if there is one. You can call it as many times as you want, and you should also call it at the end of your tast to clean things up.
func (*Refiller) Refill ¶
Refill removes the temporary file previously created, and then fill the disk. See `Fill()`.
func (*Refiller) RefillUntil ¶
RefillUntil removes the temporary file previously created, and then fill the disk. See `FillUntil()`.