Documentation
¶
Overview ¶
Package instance guards one llm-router process per database. The lock file next to the database carries a kernel file lock, so a crashed process never leaves a stale lock behind, and a JSON record of the holder for status, stop and error messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrHeld = errors.New("another llm-router instance holds the database")
ErrHeld matches the error returned when another process holds the lock.
Functions ¶
Types ¶
type HeldError ¶
type HeldError struct {
Info Info
}
HeldError reports the holder of a lock that Acquire could not take.
type Info ¶
type Info struct {
PID int `json:"pid"`
Mode Mode `json:"mode"`
Started time.Time `json:"started"`
Executable string `json:"executable"`
Address string `json:"address"`
Version string `json:"version"`
// Ready reports that the holder finished starting (MarkReady).
Ready bool `json:"ready,omitempty"`
}
Info describes the lock holder.
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
Lock is a held instance lock.
func Acquire ¶
Acquire takes the exclusive lock and records info. A zero PID and Started are filled from the current process. A held lock returns *HeldError.
Click to show internal directories.
Click to hide internal directories.