datalock

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 5 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

Overview

Package datalock is the one-maild-per-data-directory lock: an exclusive flock on <data dir>/maild.lock, held for the life of the process or until released. maild takes it before it opens the database, and mailctl takes it, only to release it, to learn that a stopped maild has let go of it (docs/adr/0046-the-desktop-flatpak-carries-its-own-maild.md). It is a no-op on Windows, whose single instance is the named pipe (ADR-0038).

Index

Constants

View Source
const FileName = "maild.lock"

FileName is the lock file in the data directory.

Variables

This section is empty.

Functions

func Acquire

func Acquire(dir string) (release func(), err error)

Acquire takes an exclusive lock on dir/maild.lock without waiting, and returns the function that releases it; the lock also ends with the process, even by a crash. dir must exist. A lock another process holds is a *BusyError. A second maild on the same data directory fails here at once, as the socket's "already listening" check cannot stop one that uses another socket, such as one in another Flatpak sandbox.

Types

type BusyError

type BusyError struct{ Dir string }

BusyError says another process holds the lock of Dir.

func (*BusyError) Error

func (e *BusyError) Error() string

Jump to

Keyboard shortcuts

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