service

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManagedVersion = 7
	ManagedMarker  = "aht managed observer service"
)

Variables

View Source
var (
	ErrForeign     = errors.New("service path contains foreign content")
	ErrUnsupported = errors.New("observer service is unsupported on this platform")
)

Functions

func RenderSystemdUnit

func RenderSystemdUnit(options Options) (string, error)

RenderSystemdUnit returns the exact managed user unit for options.

Types

type CommandExecutor

type CommandExecutor interface {
	Run(ctx context.Context, name string, args ...string) ([]byte, error)
}

CommandExecutor runs a manager command without invoking a shell.

type Options

type Options struct {
	Binary      string
	StorePath   string
	Interval    time.Duration
	GracePeriod time.Duration
	DryRun      bool
}

Options controls the managed observer service.

type Result

type Result struct {
	Platform       string `json:"platform"`
	Manager        string `json:"manager"`
	ManagedPath    string `json:"managed_path"`
	ManagedVersion int    `json:"managed_version"`
	Path           string `json:"-"`
	Version        int    `json:"-"`
	Installed      bool   `json:"installed"`
	Current        bool   `json:"current"`
	Running        bool   `json:"running"`
	Changed        bool   `json:"changed"`
	Message        string `json:"message"`
}

Result describes the service state after an operation.

func Install

func Install(ctx context.Context, options Options) (Result, error)

func Status

func Status(ctx context.Context, options Options) (Result, error)

func Uninstall

func Uninstall(ctx context.Context, options Options) (Result, error)

func Update

func Update(ctx context.Context, options Options) (Result, error)

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service manages the platform-native observer service.

func New

func New(executor CommandExecutor) *Service

New constructs a service using an injected command executor.

func (*Service) Install

func (s *Service) Install(ctx context.Context, options Options) (Result, error)

func (*Service) Status

func (s *Service) Status(ctx context.Context, options Options) (Result, error)

func (*Service) Uninstall

func (s *Service) Uninstall(ctx context.Context, options Options) (Result, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, options Options) (Result, error)

Jump to

Keyboard shortcuts

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