gaffer

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2020 License: BSD-2-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	R_OK = 4
	W_OK = 2
	X_OK = 1
)
View Source
const (
	// Time to look for new services
	DURATION_DISCOVER = 20 * time.Second
	// Time to update process state
	DURATION_PROCESS = 5 * time.Second
)
View Source
const (
	BUF_MAX_SIZE = 1024
)
View Source
const (
	// Time to look to prune new and stopped processes
	DURATION_PRUNE = 10 * time.Second
)

Variables

This section is empty.

Functions

func NewKernelStub

func NewKernelStub(config Gaffer) (rpc.GafferKernelStub, error)

func NewService

func NewService(src rpc.GafferService, instances uint32) *service

func NewServiceEx

func NewServiceEx(path, user, group string, args []string) *service

Types

type Event

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

func NewBufferEvent

func NewBufferEvent(process rpc.GafferProcess, buf []byte, t rpc.GafferState) *Event

func NewRunningEvent

func NewRunningEvent(process rpc.GafferProcess) *Event

func NewStoppedEvent

func NewStoppedEvent(process rpc.GafferProcess, err error) *Event

func (*Event) Buf

func (this *Event) Buf() []byte

func (*Event) Error

func (this *Event) Error() error

func (*Event) Process

func (this *Event) Process() rpc.GafferProcess

func (*Event) State

func (this *Event) State() rpc.GafferState

func (*Event) String

func (this *Event) String() string

type Gaffer

type Gaffer struct {
	gopi.Config
	Fifo       string             // Location for the UNIX socket
	Clientpool gopi.RPCClientPool // Clientpool to create connnections and stubs
	State      string             // Folder for storing state information
}

func (Gaffer) Name

func (Gaffer) Name() string

func (Gaffer) New

func (config Gaffer) New(log gopi.Logger) (gopi.Unit, error)

type GafferKernel

type GafferKernel interface {
	gopi.PubSub

	// CreateProcess creates a new process, which is ready to run and returns
	// a unique id for that process
	CreateProcess(rpc.GafferService) (uint32, error)

	// Extended version of create process
	CreateProcessEx(uint32, rpc.GafferService, time.Duration) (uint32, error)

	// RunProcess starts a process in NEW state
	RunProcess(uint32) error

	// StopProcess kills a process in RUNNING state
	StopProcess(uint32) error

	// Processes returns a list of running processes, filtered optionally by
	// process id and service id, both can be zero for 'any'
	Processes(uint32, uint32) []rpc.GafferProcess

	// Return a list of executables under the gaffer root, or returns
	// an empty list if the gaffer root is not defined. When argument
	// is set to true, then recurse into subfolders
	Executables(bool) []string
}

Kernel operations

type Kernel

type Kernel struct {
	gopi.Config
	Root string // Root is the path that executables are under
}

func (Kernel) Name

func (Kernel) Name() string

func (Kernel) New

func (config Kernel) New(log gopi.Logger) (gopi.Unit, error)

type Process

type Process struct {
	sync.Mutex
	sync.WaitGroup
	// contains filtered or unexported fields
}

func NewProcess

func NewProcess(id uint32, service *service, root string, timeout time.Duration) (*Process, error)

NewProcess returns a new process object which is used to control processes

func (*Process) ExitCode

func (this *Process) ExitCode() int64

func (*Process) Id

func (this *Process) Id() uint32

func (*Process) Pid

func (this *Process) Pid() uint32

func (*Process) Service

func (this *Process) Service() rpc.GafferService

func (*Process) Start

func (this *Process) Start(out chan<- *Event) error

func (*Process) State

func (this *Process) State() rpc.GafferState

func (*Process) Stop

func (this *Process) Stop() error

func (*Process) String

func (this *Process) String() string

func (*Process) Timestamp

func (this *Process) Timestamp() time.Time

Jump to

Keyboard shortcuts

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