childprocesscontroller

package
v0.0.0-...-ea0be71 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Represents a child process whose state we want to control (start, stop, keep alive after crashes),

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

func New

func New(
	cmd []string,
	description string,
	controlLogger *log.Logger,
	logger *log.Logger,
	starter func(func(context.Context) error),
) *Controller

func (*Controller) Start

func (s *Controller) Start()

means not necessarily starting a single process, but instead that we'll want to keep this subprocess alive. if it dies, it might get restarted automatically, in which case it gets a new pid, new start time etc.

func (*Controller) Status

func (s *Controller) Status() Status

func (*Controller) Stop

func (s *Controller) Stop()

same goes as for start. stop means that we'll want the subprocess to stop (or "pause"). do not call this when you want to gracefully shut down your app, but instead use the stopper mechanism which will automatically tear things down gracefully

type Status

type Status struct {
	Description string
	Pid         string
	Alive       bool
	Started     time.Time
}

Jump to

Keyboard shortcuts

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