service

package
v0.1.0-dev.20260301234141 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package service provides platform-agnostic service management actions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	Platform *op.Platform
}

Provider provides platform-agnostic service management. All platform-specific behavior is delegated to the Platform injected at construction time from op.Context.Platform.

Compensable Forward methods return (string, map[string]any, error): the service name, the compensation receipt, and an error. The map is opaque to the executor, meaningful only to the corresponding Compensate* Backward method.

+devlore:access=both

func (*Provider) CompensateDisable

func (p *Provider) CompensateDisable(state any) error

CompensateDisable undoes a Disable by enabling the service if it was enabled before.

func (*Provider) CompensateEnable

func (p *Provider) CompensateEnable(state any) error

CompensateEnable undoes an Enable by disabling the service if it wasn't enabled before.

func (*Provider) CompensateRestart

func (p *Provider) CompensateRestart(_ any) error

CompensateRestart is a no-op. A restarted service was already running; the service is still running after restart — nothing to undo.

func (*Provider) CompensateStart

func (p *Provider) CompensateStart(state any) error

CompensateStart undoes a Start by stopping the service if it wasn't running before.

func (*Provider) CompensateStop

func (p *Provider) CompensateStop(state any) error

CompensateStop undoes a Stop by starting the service if it was running before.

func (*Provider) Disable

func (p *Provider) Disable(name string, output io.Writer) (result string, state map[string]any, err error)

Disable disables a service from starting at boot. Returns compensation state with pre-action enabled status.

Parameters:

  • name: Service name (e.g., launchd label, systemd unit, Windows service)

func (*Provider) Enable

func (p *Provider) Enable(name string, output io.Writer) (result string, state map[string]any, err error)

Enable enables a service to start at boot. Returns compensation state with pre-action enabled status.

Parameters:

  • name: Service name (e.g., launchd label, systemd unit, Windows service)

func (*Provider) Enabled

func (p *Provider) Enabled(name string) (bool, error)

Enabled returns true if the named service is enabled to start at boot.

Parameters:

  • name: Service name to check

func (*Provider) Exists

func (p *Provider) Exists(name string) (bool, error)

Exists returns true if the named service exists on the system.

Parameters:

  • name: Service name to check

func (*Provider) Restart

func (p *Provider) Restart(name string, output io.Writer) (result string, state map[string]any, err error)

Restart restarts a service. Returns compensation state. Compensation is a no-op — if the service was restarted, it was already running.

Parameters:

  • name: Service name (e.g., launchd label, systemd unit, Windows service)

func (*Provider) Running

func (p *Provider) Running(name string) (bool, error)

Running returns true if the named service is currently running.

Parameters:

  • name: Service name to check

func (*Provider) Start

func (p *Provider) Start(name string, output io.Writer) (result string, state map[string]any, err error)

Start starts a service. Returns compensation state with pre-action running status.

Parameters:

  • name: Service name (e.g., launchd label, systemd unit, Windows service)

func (*Provider) Stop

func (p *Provider) Stop(name string, output io.Writer) (result string, state map[string]any, err error)

Stop stops a service. Returns compensation state with pre-action running status.

Parameters:

  • name: Service name (e.g., launchd label, systemd unit, Windows service)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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