linuxservice

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidExitCode = constants.MinInt
)

Variables

View Source
var (
	Ranges = [...]byte{
		Undefined:                Undefined.ValueByte(),
		ActiveRunning:            ActiveRunning.ValueByte(),
		DeadButPidExists:         DeadButPidExists.ValueByte(),
		DeadButVarLockFileExists: DeadButVarLockFileExists.ValueByte(),
		NotRunning:               NotRunning.ValueByte(),
		UnknownService:           UnknownService.ValueByte(),
		InvalidService:           InvalidService.ValueByte(),
		InvalidCode:              InvalidCode.ValueByte(),
	}

	StringRanges = [...]string{
		Undefined:                "Undefined",
		ActiveRunning:            "ActiveRunning",
		DeadButPidExists:         "DeadButPidExists",
		DeadButVarLockFileExists: "DeadButVarLockFileExists",
		NotRunning:               "NotRunning",
		UnknownService:           "UnknownService",
		InvalidService:           "InvalidService",
		InvalidCode:              "InvalidCode",
	}

	// RawMapping
	//
	// Reference :
	// https://gitlab.com/evatix-go/os-manuals/uploads/a3fc906f4ea29a59ebf29490391d0f86/image.png
	// https://t.ly/3jkY
	RawMapping = [...]ExitCode{
		0: ActiveRunning,
		1: DeadButPidExists,
		2: DeadButVarLockFileExists,
		3: NotRunning,
		4: UnknownService,
		5: UnknownService,
	}

	BasicEnumImpl = enumimpl.NewBasicByteUsingIndexedSlice(
		coredynamic.TypeName(ActiveRunning),
		StringRanges[:])
)

Functions

func RangesInvalidErr

func RangesInvalidErr() error

Types

type ExitCode

type ExitCode byte

ExitCode

ActiveRunning, DeadButPidExists,
DeadButVarLockFileExists, NotRunning,
UnknownService

What code means?
- Undefined (0):
    Created by us, actually its value 0
    but here we are considered for parsing issue
- ActiveRunning(1):
    We will map this to 0,
    consider as program is running and service is okay.
- DeadButPidExists(2):
    We will map this to 1,
    consider as program is dead and /var/run pid exists.
- DeadButVarLockFileExists(3):
    We will map this to 2,
    consider as program is dead and /var/lock-lock file exists.
- NotRunning(4):
    We will map this to 3,
    consider as program is not running but service exists in the system.
- UnknownService(5) / InvalidService(7):
    We will map this to 4, 5 respectively and
    consider as program doesn't exist in the system or invalid exited.

Reference :

const (
	Undefined ExitCode = iota
	ActiveRunning
	DeadButPidExists         // unit not failed
	DeadButVarLockFileExists // Unused
	NotRunning
	UnknownService // there is no service exist with that name.
	InvalidService
	InvalidCode // represents that not listed code
)

func Max

func Max() ExitCode

func Min

func Min() ExitCode

func New

func New(codeOrName string) (ExitCode, error)

func NewCode

func NewCode(code int) ExitCode

func NewCodeMapping

func NewCodeMapping(rawExitCode byte) ExitCode

NewCodeMapping (using RawMapping)

Reference : https://gitlab.com/evatix-go/os-manuals/uploads/a3fc906f4ea29a59ebf29490391d0f86/image.png https://t.ly/3jkY

func NewMust

func NewMust(codeOrName string) ExitCode

func (*ExitCode) AsBasicByteEnumContractsBinder

func (it *ExitCode) AsBasicByteEnumContractsBinder() coreinterface.BasicByteEnumContractsBinder

func (*ExitCode) AsBasicByteEnumContractsDelegateBinder

func (it *ExitCode) AsBasicByteEnumContractsDelegateBinder() coreinterface.BasicByteEnumContractsDelegateBinder

func (*ExitCode) AsBasicEnumContractsBinder

func (it *ExitCode) AsBasicEnumContractsBinder() coreinterface.BasicEnumContractsBinder

func (*ExitCode) AsJsonMarshaller

func (it *ExitCode) AsJsonMarshaller() corejson.JsonMarshaller

func (ExitCode) IsActiveRunning

func (it ExitCode) IsActiveRunning() bool

func (ExitCode) IsAllOf

func (it ExitCode) IsAllOf(codes ...int) bool

func (ExitCode) IsAnyOf

func (it ExitCode) IsAnyOf(codes ...int) bool

func (ExitCode) IsAnyOfExitCode

func (it ExitCode) IsAnyOfExitCode(anyOfItems ...ExitCode) bool

func (ExitCode) IsDeadButPidExists

func (it ExitCode) IsDeadButPidExists() bool

func (ExitCode) IsDeadButVarLockFileExists

func (it ExitCode) IsDeadButVarLockFileExists() bool

func (ExitCode) IsDefined

func (it ExitCode) IsDefined() bool

func (ExitCode) IsEqual

func (it ExitCode) IsEqual(code int) bool

func (ExitCode) IsFailed

func (it ExitCode) IsFailed() bool

func (ExitCode) IsInvalidCode

func (it ExitCode) IsInvalidCode() bool

func (ExitCode) IsInvalidService

func (it ExitCode) IsInvalidService() bool

func (ExitCode) IsNotRunning

func (it ExitCode) IsNotRunning() bool

func (ExitCode) IsSuccess

func (it ExitCode) IsSuccess() bool

func (ExitCode) IsUndefined

func (it ExitCode) IsUndefined() bool

func (ExitCode) IsUnknownService

func (it ExitCode) IsUnknownService() bool

func (ExitCode) MarshalJSON

func (it ExitCode) MarshalJSON() ([]byte, error)

func (ExitCode) MaxByte

func (it ExitCode) MaxByte() byte

func (ExitCode) MinByte

func (it ExitCode) MinByte() byte

func (ExitCode) Name

func (it ExitCode) Name() string

func (ExitCode) NameValue

func (it ExitCode) NameValue() string

func (ExitCode) RangeNamesCsv

func (it ExitCode) RangeNamesCsv() string

func (ExitCode) RangesByte

func (it ExitCode) RangesByte() []byte

func (ExitCode) String

func (it ExitCode) String() string

func (ExitCode) ToByteEnumString

func (it ExitCode) ToByteEnumString(input byte) string

func (ExitCode) ToNumberString

func (it ExitCode) ToNumberString() string

func (ExitCode) TypeName

func (it ExitCode) TypeName() string

func (*ExitCode) UnmarshalJSON

func (it *ExitCode) UnmarshalJSON(data []byte) error

func (ExitCode) UnmarshallEnumToValue

func (it ExitCode) UnmarshallEnumToValue(jsonUnmarshallingValue []byte) (byte, error)

func (ExitCode) Value

func (it ExitCode) Value() byte

func (ExitCode) ValueByte

func (it ExitCode) ValueByte() byte

Jump to

Keyboard shortcuts

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