varasto: github.com/function61/varasto/pkg/childprocesscontroller Index | Files

package childprocesscontroller

import "github.com/function61/varasto/pkg/childprocesscontroller"

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

Index

Package Files

controller.go

type Controller Uses

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

func New Uses

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

func (*Controller) Start Uses

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 Uses

func (s *Controller) Status() Status

func (*Controller) Stop Uses

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 Uses

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

Package childprocesscontroller imports 12 packages (graph) and is imported by 1 packages. Updated 2020-08-22. Refresh now. Tools for package owners.