store

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package store provides crash-safe writes for small local metadata records.

Index

Constants

View Source
const TempPrefix = ".write-"

TempPrefix names Bytes' temporary files, which a crash can leave behind.

Variables

This section is empty.

Functions

func Append

func Append(path string, data []byte) error

Append durably appends records to a file, creating it if necessary. A newly created file's directory entry is synced before Append returns.

func Bytes

func Bytes(path string, data []byte, mode os.FileMode) error

func Read

func Read(path string, dst any) error

func RemoveStaleTemps added in v0.11.0

func RemoveStaleTemps(dir string, age time.Duration) error

RemoveStaleTemps deletes this package's temporary files in dir that are older than age. Younger files may belong to a write still in progress.

func RenameInDirectory added in v0.10.0

func RenameInDirectory(tmp, path string) error

RenameInDirectory publishes a synced temporary file in the same directory. A sync failure is returned even though the rename may already be visible.

func Write

func Write(path string, value any) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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