fsyncdir

package
v0.116.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 3 Imported by: 0

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

func Dir(path string) error

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

func DirStrict(path string) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL