process

package
v0.0.0-...-e2f0dde Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: MIT Imports: 33 Imported by: 0

Documentation

Overview

Package process is a generated protocol buffer package.

It is generated from these files:

process_info.proto

It has these top-level messages:

ProcessInfo
ProcessInfoMap

Index

Constants

View Source
const (
	STOPPED  ProcessState = iota
	STARTING              = 10
	RUNNING               = 20
	BACKOFF               = 30
	STOPPING              = 40
	EXITED                = 100
	FATAL                 = 200
	UNKNOWN               = 1000
)

Variables

View Source
var (
	ErrInvalidLengthProcessInfo = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowProcessInfo   = fmt.Errorf("proto: integer overflow")
)
View Source
var PROCESSPID_name = map[int32]string{
	0: "FROZEN_PID",
}
View Source
var PROCESSPID_value = map[string]int32{
	"FROZEN_PID": 0,
}
View Source
var ProcAction_name = map[int32]string{
	0: "PA_UNKNOWN",
	1: "PA_ADD",
	2: "PA_DELETE",
	3: "PA_NOOP",
}
View Source
var ProcAction_value = map[string]int32{
	"PA_UNKNOWN": 0,
	"PA_ADD":     1,
	"PA_DELETE":  2,
	"PA_NOOP":    3,
}

Functions

func GoID

func GoID() int

func Path_expand

func Path_expand(path string) (string, error)

Types

type PROCESSPID

type PROCESSPID int32
const (
	FROZEN_PID PROCESSPID = 0
)

func (PROCESSPID) Enum

func (x PROCESSPID) Enum() *PROCESSPID

func (PROCESSPID) EnumDescriptor

func (PROCESSPID) EnumDescriptor() ([]byte, []int)

func (PROCESSPID) MarshalJSON

func (x PROCESSPID) MarshalJSON() ([]byte, error)

func (PROCESSPID) String

func (x PROCESSPID) String() string

func (*PROCESSPID) UnmarshalJSON

func (x *PROCESSPID) UnmarshalJSON(data []byte) error

type ProcAction

type ProcAction int32
const (
	PA_UNKNOWN ProcAction = 0
	PA_ADD     ProcAction = 1
	PA_DELETE  ProcAction = 2
	PA_NOOP    ProcAction = 3
)

func (ProcAction) Enum

func (x ProcAction) Enum() *ProcAction

func (ProcAction) EnumDescriptor

func (ProcAction) EnumDescriptor() ([]byte, []int)

func (ProcAction) MarshalJSON

func (x ProcAction) MarshalJSON() ([]byte, error)

func (ProcAction) String

func (x ProcAction) String() string

func (*ProcAction) UnmarshalJSON

func (x *ProcAction) UnmarshalJSON(data []byte) error

type Process

type Process struct {
	StdoutLog logger.Logger
	StderrLog logger.Logger
	// contains filtered or unexported fields
}

func NewProcess

func NewProcess(supervisor_id string, config *config.ConfigEntry) *Process

func (*Process) GetDescription

func (p *Process) GetDescription() string

func (*Process) GetExitstatus

func (p *Process) GetExitstatus() int

func (*Process) GetGroup

func (p *Process) GetGroup() string

func (*Process) GetName

func (p *Process) GetName() string

func (*Process) GetPid

func (p *Process) GetPid() int

func (*Process) GetPriority

func (p *Process) GetPriority() int

func (*Process) GetStartTime

func (p *Process) GetStartTime() time.Time

func (*Process) GetState

func (p *Process) GetState() ProcessState

Get the process state

func (*Process) GetStatus

func (p *Process) GetStatus() string

func (*Process) GetStderrLogfile

func (p *Process) GetStderrLogfile() string

func (*Process) GetStdoutLogfile

func (p *Process) GetStdoutLogfile() string

func (*Process) GetStopTime

func (p *Process) GetStopTime() time.Time

func (*Process) ProcessInfo

func (p *Process) ProcessInfo() ProcessInfo

func (*Process) SendProcessStdin

func (p *Process) SendProcessStdin(chars string) error

func (*Process) SetKillAttr

func (p *Process) SetKillAttr(startKill, exitKill bool)

func (*Process) Signal

func (p *Process) Signal(sig os.Signal, sigChildren bool) error

send signal to the process

Args:

sig - the signal to the process
sigChildren - true: send the signal to the process and its children proess

func (*Process) Start

func (p *Process) Start(wait bool, updateCb func(*Process))

start the process Args:

wait - true, wait the program started or failed

func (*Process) Stop

func (p *Process) Stop(wait bool)

send signal to process to stop it

func (*Process) TypeProcessInfo

func (p *Process) TypeProcessInfo() types.ProcessInfo

type ProcessInfo

type ProcessInfo struct {
	//  @inject_tag: yaml:"start_time"
	StartTime uint64 `protobuf:"varint,1,opt,name=StartTime" json:"StartTime" yaml:"start_time"`

	//  @inject_tag: yaml:"pid"
	// 如果 PID 为 FROZEN_PID,则说明进程是 supervisord 杀掉的
	PID int64 `protobuf:"varint,3,opt,name=PID" json:"PID" yaml:"pid"`
	//  @inject_tag: yaml:"program"
	Program string `protobuf:"bytes,4,opt,name=Program" json:"Program" yaml:"program"`
	// contains filtered or unexported fields
}

func (*ProcessInfo) CheckAlive

func (p *ProcessInfo) CheckAlive() bool

func (*ProcessInfo) ConfigEntry

func (p *ProcessInfo) ConfigEntry() *config.ConfigEntry

func (*ProcessInfo) Descriptor

func (*ProcessInfo) Descriptor() ([]byte, []int)

func (*ProcessInfo) Equal

func (this *ProcessInfo) Equal(that interface{}) bool

func (*ProcessInfo) GoString

func (this *ProcessInfo) GoString() string

func (*ProcessInfo) IsFrozen

func (p *ProcessInfo) IsFrozen() bool

func (*ProcessInfo) Marshal

func (m *ProcessInfo) Marshal() (dAtA []byte, err error)

func (*ProcessInfo) MarshalTo

func (m *ProcessInfo) MarshalTo(dAtA []byte) (int, error)

func (*ProcessInfo) ProtoMessage

func (*ProcessInfo) ProtoMessage()

func (*ProcessInfo) Reset

func (m *ProcessInfo) Reset()

func (*ProcessInfo) Size

func (m *ProcessInfo) Size() (n int)

func (*ProcessInfo) Stop

func (p *ProcessInfo) Stop(wait bool)

send signal to process to stop it

func (*ProcessInfo) String

func (this *ProcessInfo) String() string

func (*ProcessInfo) TypeProcessInfo

func (p *ProcessInfo) TypeProcessInfo() types.ProcessInfo

func (*ProcessInfo) Unmarshal

func (m *ProcessInfo) Unmarshal(dAtA []byte) error

func (*ProcessInfo) Validate

func (this *ProcessInfo) Validate() error

func (*ProcessInfo) VerboseEqual

func (this *ProcessInfo) VerboseEqual(that interface{}) error

func (*ProcessInfo) XXX_DiscardUnknown

func (m *ProcessInfo) XXX_DiscardUnknown()

func (*ProcessInfo) XXX_Marshal

func (m *ProcessInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ProcessInfo) XXX_Merge

func (dst *ProcessInfo) XXX_Merge(src proto.Message)

func (*ProcessInfo) XXX_Size

func (m *ProcessInfo) XXX_Size() int

func (*ProcessInfo) XXX_Unmarshal

func (m *ProcessInfo) XXX_Unmarshal(b []byte) error

type ProcessInfoMap

type ProcessInfoMap struct {

	//  @inject_tag: yaml:"version"
	Version uint64 `protobuf:"varint,1,opt,name=Version" json:"Version" yaml:"version"`
	//  @inject_tag: yaml:"info_map"
	InfoMap map[string]ProcessInfo `` /* 140-byte string literal not displayed */
	// contains filtered or unexported fields
}

func NewProcessInfoMap

func NewProcessInfoMap() *ProcessInfoMap

func (*ProcessInfoMap) Descriptor

func (*ProcessInfoMap) Descriptor() ([]byte, []int)

func (*ProcessInfoMap) Equal

func (this *ProcessInfoMap) Equal(that interface{}) bool

func (*ProcessInfoMap) GetProcessInfo

func (m *ProcessInfoMap) GetProcessInfo(program string) (ProcessInfo, bool)

func (*ProcessInfoMap) GoString

func (this *ProcessInfoMap) GoString() string

func (*ProcessInfoMap) Marshal

func (m *ProcessInfoMap) Marshal() (dAtA []byte, err error)

func (*ProcessInfoMap) MarshalTo

func (m *ProcessInfoMap) MarshalTo(dAtA []byte) (int, error)

func (*ProcessInfoMap) ProtoMessage

func (*ProcessInfoMap) ProtoMessage()

func (*ProcessInfoMap) Reset

func (m *ProcessInfoMap) Reset()

func (*ProcessInfoMap) Size

func (m *ProcessInfoMap) Size() (n int)

func (*ProcessInfoMap) String

func (this *ProcessInfoMap) String() string

func (*ProcessInfoMap) Unmarshal

func (m *ProcessInfoMap) Unmarshal(dAtA []byte) error

func (*ProcessInfoMap) Validate

func (this *ProcessInfoMap) Validate() error

func (*ProcessInfoMap) VerboseEqual

func (this *ProcessInfoMap) VerboseEqual(that interface{}) error

func (*ProcessInfoMap) XXX_DiscardUnknown

func (m *ProcessInfoMap) XXX_DiscardUnknown()

func (*ProcessInfoMap) XXX_Marshal

func (m *ProcessInfoMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ProcessInfoMap) XXX_Merge

func (dst *ProcessInfoMap) XXX_Merge(src proto.Message)

func (*ProcessInfoMap) XXX_Size

func (m *ProcessInfoMap) XXX_Size() int

func (*ProcessInfoMap) XXX_Unmarshal

func (m *ProcessInfoMap) XXX_Unmarshal(b []byte) error

type ProcessManager

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

func NewProcessManager

func NewProcessManager() *ProcessManager

func (*ProcessManager) AddProc

func (pm *ProcessManager) AddProc(proc *Process)

func (*ProcessManager) Clear

func (pm *ProcessManager) Clear()

clear all the processes

func (*ProcessManager) CreateProcess

func (pm *ProcessManager) CreateProcess(supervisor_id string, config *config.ConfigEntry) *Process

func (*ProcessManager) Find

func (pm *ProcessManager) Find(name string) *Process

return process if found or nil if not found

func (*ProcessManager) FindMatch

func (pm *ProcessManager) FindMatch(name string) []*Process

func (*ProcessManager) FindProcessInfo

func (pm *ProcessManager) FindProcessInfo(name string) *ProcessInfo

func (*ProcessManager) ForEachProcess

func (pm *ProcessManager) ForEachProcess(procFunc func(p *Process))

func (*ProcessManager) GetActivePrestartProcess

func (pm *ProcessManager) GetActivePrestartProcess() (int, []ProcessInfo)

the return value list: the first is prestart process number the second is the active prestart process name array

func (*ProcessManager) GetAllInfomapProcess

func (pm *ProcessManager) GetAllInfomapProcess() (int, []ProcessInfo)

用于 status _infomap

func (*ProcessManager) GetDeadPrestartProcess

func (pm *ProcessManager) GetDeadPrestartProcess() (int, []string)

the return value list: the first is prestart process number the second is the dead prestart process name array

func (*ProcessManager) GetFrozenPrestartProcess

func (pm *ProcessManager) GetFrozenPrestartProcess() (int, []ProcessInfo)

func (*ProcessManager) GetPrestartProcess

func (pm *ProcessManager) GetPrestartProcess() (int, []ProcessInfo)

func (*ProcessManager) GetProcsProcessInfo

func (pm *ProcessManager) GetProcsProcessInfo(name string) *Process

return process if found or nil if not found

func (*ProcessManager) KillAllProcesses

func (pm *ProcessManager) KillAllProcesses(procFunc func(ProcessInfo))

func (*ProcessManager) OutputInfomap

func (pm *ProcessManager) OutputInfomap()

func (*ProcessManager) Remove

func (pm *ProcessManager) Remove(name string) *Process

remove the process from the manager

Arguments: name - the name of program

Return the process or nil

func (*ProcessManager) RemoveAllProcesses

func (pm *ProcessManager) RemoveAllProcesses(procFunc func(ProcessInfo))

func (*ProcessManager) RemoveProcessInfo

func (pm *ProcessManager) RemoveProcessInfo(name string) ProcessInfo

func (*ProcessManager) RemoveProcessInfoFile

func (pm *ProcessManager) RemoveProcessInfoFile()

func (*ProcessManager) StartAutoStartPrograms

func (pm *ProcessManager) StartAutoStartPrograms()

func (*ProcessManager) StopAllProcesses

func (pm *ProcessManager) StopAllProcesses(start bool, exit bool)

func (*ProcessManager) StopProcess

func (pm *ProcessManager) StopProcess(name string, wait bool) *Process

stop the process

Arguments: name - the name of program

Return the process or nil

func (*ProcessManager) StopProcessInfo

func (pm *ProcessManager) StopProcessInfo(name string, wait bool) *ProcessInfo

func (*ProcessManager) UpdateConfig

func (pm *ProcessManager) UpdateConfig(config *config.ConfigEntry)

func (*ProcessManager) UpdateProcessInfo

func (pm *ProcessManager) UpdateProcessInfo(proc *Process)

func (*ProcessManager) ValidateStartPs

func (pm *ProcessManager) ValidateStartPs() ([]string, []string)

type ProcessState

type ProcessState int64

func (ProcessState) String

func (p ProcessState) String() string

Jump to

Keyboard shortcuts

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