internal

package
v2.0.0-beta7 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StateInactive - no associated process
	StateInactive int64 = iota

	// StateReady - ready for job.
	StateReady

	// StateWorking - working on given payload.
	StateWorking

	// StateInvalid - indicates that WorkerProcess is being disabled and will be removed.
	StateInvalid

	// StateStopping - process is being softly stopped.
	StateStopping

	StateKilling

	// State of worker, when no need to allocate new one
	StateDestroyed

	// StateStopped - process has been terminated.
	StateStopped

	// StateErrored - error WorkerState (can't be used).
	StateErrored

	StateRemove
)

Variables

This section is empty.

Functions

func FetchPID

func FetchPID(rl relay.Relay) (int64, error)

func SendControl

func SendControl(rl relay.Relay, payload interface{}) error

Types

type State

type State interface {
	fmt.Stringer
	// Value returns WorkerState value
	Value() int64
	// Set sets the WorkerState
	Set(value int64)
	// NumJobs shows how many times WorkerProcess was invoked
	NumExecs() int64
	// IsActive returns true if WorkerProcess not Inactive or Stopped
	IsActive() bool
	// RegisterExec using to registering php executions
	RegisterExec()
	// SetLastUsed sets worker last used time
	SetLastUsed(lu uint64)
	// LastUsed return worker last used time
	LastUsed() uint64
}

State represents WorkerProcess status and updated time.

type StopCommand

type StopCommand struct {
	Stop bool `json:"stop"`
}

type WorkerState

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

func NewWorkerState

func NewWorkerState(value int64) *WorkerState

Thread safe

func (*WorkerState) IsActive

func (s *WorkerState) IsActive() bool

IsActive returns true if WorkerProcess not Inactive or Stopped

func (*WorkerState) LastUsed

func (s *WorkerState) LastUsed() uint64

func (*WorkerState) NumExecs

func (s *WorkerState) NumExecs() int64

NumExecs returns number of registered WorkerProcess execs.

func (*WorkerState) RegisterExec

func (s *WorkerState) RegisterExec()

register new execution atomically

func (*WorkerState) Set

func (s *WorkerState) Set(value int64)

change WorkerState value (status)

func (*WorkerState) SetLastUsed

func (s *WorkerState) SetLastUsed(lu uint64)

Update last used time

func (*WorkerState) String

func (s *WorkerState) String() string

String returns current WorkerState as string.

func (*WorkerState) Value

func (s *WorkerState) Value() int64

Value WorkerState returns WorkerState value

Jump to

Keyboard shortcuts

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