Documentation
¶
Overview ¶
Package fsyncdir centralizes kojo's directory-fsync recipe: open a directory read-only and Sync it so a preceding rename/unlink is durable across a crash. It replaces four near-identical copies that previously lived in internal/{blob,oplog,agent,migrate}.
The single entry point is Dir, which propagates real fsync errors and treats only platform "unsupported" errors as non-fatal. An earlier DirLenient variant that swallowed every Sync error was removed once its last caller (internal/agent's memory truncate) switched to Dir so real durability failures surface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dir ¶
Dir fsyncs the directory at path. It opens the directory (O_RDONLY) and calls Sync. Filesystems / platforms that do not support fsync on a directory handle (Windows, some network filesystems) report an "unsupported" error, which is treated as a non-fatal best-effort success: the preceding rename is already on disk. Real errors are propagated.
This matches the semantics historically used by internal/blob, internal/oplog and internal/agent.
func DirStrict ¶
DirStrict fsyncs the directory at path on POSIX and propagates every Sync error, including the "unsupported" errors that Dir deliberately swallows. internal/migrate uses this: its atomicWrite treats a directory-fsync failure as a hard error so migration crash recovery has well-defined semantics. Unlike Dir, no error is filtered.
Types ¶
This section is empty.