service

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRetryStrategy = &RetryStrategy{
	Initial:     time.Second,
	MaxRetries:  9999,
	MaxDuration: 60 * time.Second,
	MaxJitter:   time.Second,
}
View Source
var ErrNotWindowsService = errors.New("process not started as Windows service")

Functions

This section is empty.

Types

type RetryStrategy added in v1.1.0

type RetryStrategy struct {
	Initial     time.Duration
	MaxRetries  uint
	MaxDuration time.Duration
	MaxJitter   time.Duration
}

func (*RetryStrategy) Retry added in v1.1.0

func (s *RetryStrategy) Retry(f func() error) error

type Service

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

Service implements svc.Service

func (*Service) Context

func (s *Service) Context() context.Context

Context implements svc.Context

func (*Service) Init

func (s *Service) Init(env svc.Environment) error

Init implements svc.Service

func (*Service) Start

func (s *Service) Start() error

Start implements svc.Service

func (*Service) Stop

func (s *Service) Stop() error

Stop implements svc.Service

type ServiceConfig

type ServiceConfig struct {
	ExecPath    string
	LogPath     string
	Name        string
	DisplayName string
}

ServiceConfig holds information to create a Windows service

func (*ServiceConfig) Install

func (s *ServiceConfig) Install() error

Install installs the service executable, creates the Windows service, and starts it

func (*ServiceConfig) Service

func (s *ServiceConfig) Service(main func(w io.Writer) error) *Service

Service returns a new Service for use with svc.Run

func (*ServiceConfig) Uninstall

func (s *ServiceConfig) Uninstall() error

Uninstall uninstalls the service

Jump to

Keyboard shortcuts

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