Documentation
¶
Overview ¶
Package save contains streaming, crash-safe document persistence.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Atomic ¶
func Atomic(path string, mode os.FileMode, prefix []byte, writeContent func(io.Writer) (int64, error)) (int64, error)
Atomic streams content into a same-directory temporary file, flushes it, and atomically replaces path. The caller supplies an immutable document snapshot.
func AtomicChecked ¶
func AtomicChecked(path string, mode os.FileMode, prefix []byte, writeContent func(io.Writer) (int64, error), beforeReplace func() error) (int64, error)
AtomicChecked performs a final conflict check after the potentially long stream write and immediately before replacing the original file.
func SyncParent ¶ added in v0.3.0
SyncParent retries durability of the directory entry containing path. It is a no-op on platforms whose replacement primitive already provides the required guarantee.
Types ¶
type DurabilityError ¶ added in v0.3.0
DurabilityError means the target name was atomically replaced, but the platform could not confirm that the directory entry is durable across a power loss. Callers must treat the content as committed.
func (*DurabilityError) Committed ¶ added in v0.3.0
func (e *DurabilityError) Committed() bool
func (*DurabilityError) Error ¶ added in v0.3.0
func (e *DurabilityError) Error() string
func (*DurabilityError) Unwrap ¶ added in v0.3.0
func (e *DurabilityError) Unwrap() error