bpm

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: Apache-2.0 Imports: 12 Imported by: 10

Documentation

Index

Constants

View Source
const (
	DefaultProcPrefix = "/proc"
)

Variables

This section is empty.

Functions

func GetNsPath added in v1.0.3

func GetNsPath(pid uint32, typ NsType) string

GetNsPath returns corresponding namespace path

func NewBlockingBuffer added in v1.2.0

func NewBlockingBuffer() *blockingBuffer

Types

type BackgroundProcessManager

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

BackgroundProcessManager manages all background processes

func NewBackgroundProcessManager

func NewBackgroundProcessManager() BackgroundProcessManager

NewBackgroundProcessManager creates a background process manager

func (*BackgroundProcessManager) KillBackgroundProcess

func (m *BackgroundProcessManager) KillBackgroundProcess(ctx context.Context, pid int, startTime int64) error

KillBackgroundProcess sends SIGTERM to process

func (*BackgroundProcessManager) StartProcess

func (m *BackgroundProcessManager) StartProcess(cmd *ManagedProcess) error

StartProcess manages a process in manager

type ManagedProcess

type ManagedProcess struct {
	*exec.Cmd

	// If the identifier is not nil, process manager should make sure no other
	// process with this identifier is running when executing this command
	Identifier *string
}

ManagedProcess is a process which can be managed by backgroundProcessManager

type NsType

type NsType string
const (
	MountNS NsType = "mnt"
	// uts namespace is not supported yet
	// UtsNS   NsType = "uts"
	IpcNS NsType = "ipc"
	NetNS NsType = "net"
	PidNS NsType = "pid"
)

type ProcessBuilder

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

ProcessBuilder builds a exec.Cmd for daemon

func DefaultProcessBuilder

func DefaultProcessBuilder(cmd string, args ...string) *ProcessBuilder

DefaultProcessBuilder returns the default process builder

func (*ProcessBuilder) Build

func (b *ProcessBuilder) Build() *ManagedProcess

Build builds the process

func (*ProcessBuilder) EnableLocalMnt added in v1.0.3

func (b *ProcessBuilder) EnableLocalMnt() *ProcessBuilder

func (*ProcessBuilder) EnablePause

func (b *ProcessBuilder) EnablePause() *ProcessBuilder

EnablePause enables pause for process

func (*ProcessBuilder) SetContext

func (b *ProcessBuilder) SetContext(ctx context.Context) *ProcessBuilder

SetContext sets context for process

func (*ProcessBuilder) SetIdentifier

func (b *ProcessBuilder) SetIdentifier(id string) *ProcessBuilder

SetIdentifier sets the identifier of the process

func (*ProcessBuilder) SetNS

func (b *ProcessBuilder) SetNS(pid uint32, typ NsType) *ProcessBuilder

SetNS sets the namespace of the process

func (*ProcessBuilder) SetNSOpt added in v1.0.3

func (b *ProcessBuilder) SetNSOpt(options []nsOption) *ProcessBuilder

SetNSOpt sets the namespace of the process

type ProcessPair

type ProcessPair struct {
	Pid        int
	CreateTime int64
}

ProcessPair is an identifier for process

Jump to

Keyboard shortcuts

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