processchief

package module
v0.0.0-...-73375e4 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: MIT Imports: 20 Imported by: 0

README

process chief

Process Chief (PC) - is a dead simple processes hypervisor. Contains utils and Go library for processes control.

how to install

go install -v github.com/nordicdyno/process-chief/cmd/...

components

  • pc-srv - server
  • pc-ctl - CLI control util (client)
  • pc-log - handy logger with ability to reopen logs by signal, useful for log rotation (optional)

how to use utils

start server:

pc-srv

show services list:

pc-ctl list

add service:

pc-ctl add -h

how to use library

todo

  • add design rationales to README
  • docs
  • tests
  • set server listen ports via command line
  • http API docs / examples
  • pretty output
  • wait process command

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chief

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

Chief is the chief of all managed processes.

func NewChief

func NewChief() *Chief

func (*Chief) AddProcess

func (c *Chief) AddProcess(name string, sp SetProc) (*ProcStatus, error)

func (*Chief) AllProcesses

func (c *Chief) AllProcesses() []ProcStatus

func (*Chief) DeleteProcess

func (c *Chief) DeleteProcess(name string) error

TODO: refactor Stop and Delete commands

func (*Chief) Get

func (c *Chief) Get(name string) (*ProcStatus, error)

func (*Chief) GetProcess

func (c *Chief) GetProcess(name string) (*ProcStatus, error)

func (*Chief) LoggerSignal

func (c *Chief) LoggerSignal(name string, signal int32) error

func (*Chief) ProcessSignal

func (c *Chief) ProcessSignal(name string, signal int32) error

func (*Chief) StopAll

func (c *Chief) StopAll()

func (*Chief) StopProcess

func (c *Chief) StopProcess(name string) error

func (*Chief) UpdateProcess

func (c *Chief) UpdateProcess(name string, sp SetProc) (*ProcStatus, error)

type ControlServer

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

func NewControlServer

func NewControlServer(chief *Chief) *ControlServer

func (*ControlServer) AddProcess

func (cs *ControlServer) AddProcess(ctx context.Context, pSet *pb.SetProc) (*pb.ProcStatus, error)

func (*ControlServer) AllProcesses

func (cs *ControlServer) AllProcesses(context.Context, *pb.Nope) (*pb.ProcessesStatus, error)

AllProcesses returns all registered processes.

func (*ControlServer) DeleteProcess

func (cs *ControlServer) DeleteProcess(ctx context.Context, name *pb.ProcName) (*pb.Result, error)

DeleteService stops and removes process by name.

func (*ControlServer) GetProcess

func (cs *ControlServer) GetProcess(ctx context.Context, pn *pb.ProcName) (*pb.ProcStatus, error)

GetProcess returns process status description by name.

func (*ControlServer) Halt

func (cs *ControlServer) Halt(context.Context, *pb.Nope) (*pb.Result, error)

Halt stops chief and stop process.

func (*ControlServer) LoggerSignal

func (cs *ControlServer) LoggerSignal(ctx context.Context, svcSig *pb.Signal) (*pb.Result, error)

func (*ControlServer) ProcessSignal

func (cs *ControlServer) ProcessSignal(ctx context.Context, svcSig *pb.Signal) (*pb.Result, error)

func (*ControlServer) Start

func (cs *ControlServer) Start(ctx context.Context) error

func (*ControlServer) Stop

func (cs *ControlServer) Stop(ctx context.Context)

func (*ControlServer) UpdateProcess

func (cs *ControlServer) UpdateProcess(ctx context.Context, pSet *pb.SetProc) (*pb.ProcStatus, error)

type ProcOption

type ProcOption func(*processCfg)

func Env

func Env(s string) ProcOption

func WorkDir

func WorkDir(s string) ProcOption

type ProcStatus

type ProcStatus = pb.ProcStatus

type Process

type Process = pb.Process

type SetProc

type SetProc = pb.SetProc

func NewProcess

func NewProcess(name string, commandLine string, opts ...ProcOption) SetProc

Directories

Path Synopsis
cmd
Package pb is a reverse proxy.
Package pb is a reverse proxy.

Jump to

Keyboard shortcuts

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