detector

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandDetector

type CommandDetector struct{ Command string }

CommandDetector runs a command that should succeed if the process is running.

func (CommandDetector) Alive

func (d CommandDetector) Alive() (bool, error)

func (CommandDetector) Describe

func (d CommandDetector) Describe() string

type Detector

type Detector interface {
	// Alive returns true if the process is detected as running.
	Alive() (bool, error)
	// Describe returns a human-readable description of the detection method.
	Describe() string
}

Detector is a strategy that determines if a process is running. Implementations may check PID file, PID number, or a custom script. It must be safe for concurrent use.

type PIDDetector

type PIDDetector struct{ PID int }

PIDDetector detects by a provided PID number.

func (PIDDetector) Alive

func (d PIDDetector) Alive() (bool, error)

func (PIDDetector) Describe

func (d PIDDetector) Describe() string

type PIDFileDetector

type PIDFileDetector struct {
	PIDFile string
}

PIDFileDetector detects a process via a PID file.

func (PIDFileDetector) Alive

func (d PIDFileDetector) Alive() (bool, error)

func (PIDFileDetector) Describe

func (d PIDFileDetector) Describe() string

Jump to

Keyboard shortcuts

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