Malachi.Storage.Directory (malachi v0.22.7)

View Source

Makes a directory's entries durable.

Creating or renaming a file changes its directory, and an fsync of the file itself does not persist that change: a power failure can lose the new name while keeping the content. The directory has to be fsynced too. Erlang opens a directory for that with the :directory mode (a plain :file.open/2 on a directory answers :eisdir), which OTP 28, the release this project builds on, supports.

Summary

Functions

Fsyncs dir, so every entry created, renamed or removed in it so far survives a power failure. Answers the error when the directory cannot be opened or synced.

Functions

sync(dir)

@spec sync(Path.t()) :: :ok | {:error, term()}

Fsyncs dir, so every entry created, renamed or removed in it so far survives a power failure. Answers the error when the directory cannot be opened or synced.