storage

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConflict = errors.New("file changed outside Beech")

ErrConflict means that another process changed the file after Beech loaded it.

Functions

func NewPath

func NewPath(path string) (string, error)

NewPath resolves a path for a document that does not exist yet.

Types

type Fingerprint

type Fingerprint struct {
	Exists bool
	Hash   [sha256.Size]byte
}

Fingerprint identifies the file content used by the current document.

func Save

func Save(path string, data []byte, expected Fingerprint, mode fs.FileMode) (Fingerprint, error)

Save atomically writes data if the target still matches expected.

type LoadedFile

type LoadedFile struct {
	Path        string
	Data        []byte
	Fingerprint Fingerprint
	Mode        fs.FileMode
}

LoadedFile is the result of loading a document path.

func Load

func Load(path string) (LoadedFile, error)

Load reads path and resolves a symlink so atomic saves do not replace it.

Jump to

Keyboard shortcuts

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