fsutil

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package fsutil provides filesystem utilities that abstract over OS-specific behaviour differences, particularly Windows mandatory file locking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RobustRename

func RobustRename(oldpath, newpath string) error

RobustRename calls os.Rename with retry on transient Windows file-locking errors (ERROR_ACCESS_DENIED, ERROR_SHARING_VIOLATION). On POSIX systems rename never fails from transient locks, so retries add zero overhead in the success path and fail immediately on the first error.

The retry budget is ~155 ms (5 attempts: 5, 10, 20, 40, 80 ms). This gives external processes (Windows Defender, Search Indexer) time to release handles opened for scanning after a file write/close.

Callers MUST fsync and close the source file before calling RobustRename.

Types

This section is empty.

Jump to

Keyboard shortcuts

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