Table of Contents

Internal classStaticInternal DirectoryFsync

Namespace
Rowles.LeanLucene.Store
Assembly
Rowles.LeanLucene.dll

Cross-platform helper that flushes a directory's metadata (file-entry renames, creations, deletions) to durable storage. Required for crash-safe atomic-rename commit protocols on POSIX filesystems where directory entries are buffered independently of file contents.

internal static class DirectoryFsync
DirectoryFsync

Remarks

On Linux and macOS this opens the directory read-only, calls fsync, and closes the descriptor. On Windows this is a no-op: NTFS journals directory updates synchronously as part of the metadata transaction log, so an explicit directory sync is unnecessary (and the Win32 API has no equivalent to fsync(directory_fd)).

Public method Sync(string)

Forces the directory's metadata to be persisted to the underlying storage device. On Windows this is a no-op. On Unix, errors are swallowed: directory sync is best-effort (some filesystems and exotic mounts do not support it; the surrounding rename remains atomic-by-name even without it).

Public method SyncFile(string)

Forces a previously written file's contents to be persisted to the underlying storage device. Equivalent to fsync on Unix and FlushFileBuffers on Windows. Errors are swallowed (best-effort).