atomicfile

package
v0.17.2 Latest Latest
Warning

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

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

Documentation

Overview

Package atomicfile writes a file a watcher reads: whole or not at all, and not at all when it already holds what would be written. Traefik reloads on every write to the directory it watches and reads a half-written file the moment it appears, so both the Traefik routing adapter and the Docker runtime's edge certificates (R-417) write that way. A leaf package, as internal/registrylimit is, so adapters may import it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteIfChanged

func WriteIfChanged(path string, body []byte, mode os.FileMode) error

WriteIfChanged writes body to path through a temporary file renamed into place, unless path already holds body. The directory is created if missing.

The temporary file's name is its own (CreateTemp), as keyfile.place's is: route sync, the reconciler and a deploy may write one route at once (R-417), and with one fixed name a writer renamed another's half-written file into place. It is hidden and has no .yml or .toml extension, so a watcher does not load it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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