Help us shape the future of Go! Take the 2026 Go Developer Survey

durable

package
v1.0.0-rc.12 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package durable writes a file so that a crash leaves either the old file or the whole new one under its name, never a partial one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SyncDir

func SyncDir(dir string) error

SyncDir makes the names in dir durable: a caller that accepts a file it did not write itself (one an earlier Write left, perhaps before its own directory sync failed) syncs its directory before relying on it.

func Write

func Write(dir, name string, body []byte, perm fs.FileMode, noReplace bool) (existed bool, err error)

Write puts body at dir/name with mode perm: written to a temporary file in dir, fsynced, moved into place and the directory fsynced. The move is a rename, replacing any file there, or with noReplace a hard link, which leaves an existing file untouched and reports existed. dir must exist.

Types

This section is empty.

Jump to

Keyboard shortcuts

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