Documentation
¶
Index ¶
- Constants
- Variables
- func RenderSystemdUnit(options Options) (string, error)
- func SystemdUnitPath() (string, error)
- type CommandExecutor
- type CommandFunc
- type Options
- type Result
- type Runner
- type Service
- func (s *Service) Install(ctx context.Context, options Options) (Result, error)
- func (s *Service) Status(ctx context.Context, options Options) (Result, error)
- func (s *Service) Uninstall(ctx context.Context, options Options) (Result, error)
- func (s *Service) Update(ctx context.Context, options Options) (Result, error)
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 ¶
RenderSystemdUnit returns the exact managed user unit for options.
func SystemdUnitPath ¶
SystemdUnitPath returns the managed user unit path.
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 CommandFunc ¶
CommandFunc adapts a function into a CommandExecutor.
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.
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.
Click to show internal directories.
Click to hide internal directories.