store

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLockTimeout = 2 * time.Second

Variables

This section is empty.

Functions

func CommitDir

func CommitDir(root, final string, populate func(stage string) error) (err error)

CommitDir builds a complete entity in a hidden same-parent staging directory and publishes it with one rename. Failed builds never expose the final entity name and temporary state is removed on every return path.

func EnsureDirWithin

func EnsureDirWithin(root, dir string) (string, error)

EnsureDirWithin validates every existing path component before creating anything, then creates missing components one at a time. Symlinks are never accepted, including symlinked reserved metadata directories.

func EventID

func EventID(now time.Time) string

func ResolveSection

func ResolveSection(root, section string) (string, error)

func Slug

func Slug(value string) string

func SyncDir

func SyncDir(path string) error

SyncDir persists directory entry changes on filesystems that support it.

func WithSagaLock

func WithSagaLock(root string, timeout time.Duration, operation func() error) error

WithSagaLock serializes supported writers across processes. Lock acquisition is bounded so a busy saga produces a clear error instead of hanging.

func WriteFile

func WriteFile(path string, data []byte, perm fs.FileMode, exclusive bool) (err error)

WriteFile writes data through a same-directory temporary file. Exclusive writes use a hard link for an atomic create-if-absent commit; replacement writes use an atomic rename.

func WriteJSON

func WriteJSON(path string, value any, exclusive bool) error

WriteJSON writes one complete JSON record without exposing a partially written destination. The destination's parent directory must already exist.

Types

This section is empty.

Jump to

Keyboard shortcuts

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