Table of Contents

Internal classStaticInternal DirectoryFsync

Namespace
Rowles.LeanCorpus.Store
Assembly
Rowles.LeanCorpus.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, bool)

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 when strict is false (best-effort) or thrown as System.IO.IOException when true.

Internal methodInternal SyncCore(string, bool, bool, OpenDirectoryDelegate, FileDescriptorDelegate, FileDescriptorDelegate, GetLastErrorDelegate)

Public method SyncFile(string, bool)

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 when strict is false; otherwise they propagate.