atomicfile

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: AGPL-3.0, AGPL-3.0-only Imports: 3 Imported by: 0

Documentation

Overview

Package atomicfile provides atomic file write operations.

All writes follow the same contract: write to a temporary file in the same directory as the target, fsync, then rename. This guarantees that readers never see a partially-written file — they see the old content or the new content, never a torn intermediate state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteFile

func WriteFile(path string, data []byte, perm os.FileMode) error

WriteFile writes data atomically: tmp → fsync → rename. The temporary file is created in the same directory as path to ensure the rename is same-filesystem (required for atomic rename on POSIX).

Types

This section is empty.

Jump to

Keyboard shortcuts

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