module

LavinMQ::FileSystem

Durable variants of directory entry changes. Data written through a file isn't reachable after a crash until its directory entry is on disk too, so renames and newly created directories fsync the directory they changed. The fsyncs are skipped when sync is disabled.

Class methods

durable_rename(source : String, destination : String) : Nil
Source
durable_rename(source : File | MFile, destination : String) : Nil

Renames the open file in place, so the caller can keep using it under its new path

Source
fsync_dir(path : String) : Nil
Source
mkdir_p(path : String) : Nil

Like Dir.mkdir_p, but also fsyncs the parent of each created directory

Source
mkdir_p(path : String, & : String -> ) : Nil

Like Dir.mkdir_p, but yields the parent of each created directory, outermost first, for the caller to make its new entry durable

Source
out_of_file_descriptors?(ex : Exception) : Bool

Whether ex is a failed syscall for lack of a free file descriptor, either in this process (EMFILE) or system wide (ENFILE)

Source
replace(path : String, & : File -> ) : Nil

Atomically replaces path with what the block writes, via a tmp file

Source
syncfs(fd : Int32) : Nil
Source