linuxservicestate

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	InvalidExitCode = constants.MinInt
)

Variables

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

	StringRanges = [...]string{
		Invalid:                  "Invalid",
		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.New.BasicByte.UsingTypeSlice(
		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?
- Invalid (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 (
	Invalid 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) AllNameValues

func (it ExitCode) AllNameValues() []string

func (ExitCode) AsBasicByteEnumContractsBinder

func (it ExitCode) AsBasicByteEnumContractsBinder() enuminf.BasicByteEnumContractsBinder

func (ExitCode) AsBasicByteEnumContractsDelegateBinder

func (it ExitCode) AsBasicByteEnumContractsDelegateBinder() enuminf.BasicByteEnumContractsDelegateBinder

func (ExitCode) AsBasicEnumContractsBinder

func (it ExitCode) AsBasicEnumContractsBinder() enuminf.BasicEnumContractsBinder

func (ExitCode) AsJsonMarshaller

func (it ExitCode) AsJsonMarshaller() corejson.JsonMarshaller

func (ExitCode) EnumType

func (it ExitCode) EnumType() enuminf.EnumTyper

func (ExitCode) Format

func (it ExitCode) Format(format string) (compiled string)

func (ExitCode) IntegerEnumRanges

func (it ExitCode) IntegerEnumRanges() []int

func (ExitCode) IsActiveRunning

func (it ExitCode) IsActiveRunning() bool

func (ExitCode) IsAllOf

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

func (ExitCode) IsAnyNamesOf

func (it ExitCode) IsAnyNamesOf(names ...string) bool

func (ExitCode) IsAnyOf

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

func (ExitCode) IsAnyOfExitCode

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

func (ExitCode) IsAnyValuesEqual

func (it ExitCode) IsAnyValuesEqual(anyByteValues ...byte) bool

func (ExitCode) IsByteValueEqual

func (it ExitCode) IsByteValueEqual(value byte) 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) IsInvalid

func (it ExitCode) IsInvalid() bool

func (ExitCode) IsInvalidCode

func (it ExitCode) IsInvalidCode() bool

func (ExitCode) IsInvalidService

func (it ExitCode) IsInvalidService() bool

func (ExitCode) IsNameEqual

func (it ExitCode) IsNameEqual(name string) bool

func (ExitCode) IsNameOf

func (it ExitCode) IsNameOf(anyNames ...string) 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) IsValid

func (it ExitCode) IsValid() bool

func (ExitCode) IsValueEqual

func (it ExitCode) IsValueEqual(value byte) bool

func (ExitCode) MarshalJSON

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

func (ExitCode) MaxByte

func (it ExitCode) MaxByte() byte

func (ExitCode) MaxInt

func (it ExitCode) MaxInt() int

func (ExitCode) MaxMaxAny

func (it ExitCode) MaxMaxAny() (min, max interface{})

func (ExitCode) MaxValueString

func (it ExitCode) MaxValueString() string

func (ExitCode) MinByte

func (it ExitCode) MinByte() byte

func (ExitCode) MinInt

func (it ExitCode) MinInt() int

func (ExitCode) MinValueString

func (it ExitCode) MinValueString() string

func (ExitCode) Name

func (it ExitCode) Name() string

func (ExitCode) NameValue

func (it ExitCode) NameValue() string

func (ExitCode) OnlySupportedErr

func (it ExitCode) OnlySupportedErr(names ...string) error

func (ExitCode) OnlySupportedMsgErr

func (it ExitCode) OnlySupportedMsgErr(message string, names ...string) error

func (ExitCode) RangeNamesCsv

func (it ExitCode) RangeNamesCsv() string

func (ExitCode) RangesByte

func (it ExitCode) RangesByte() []byte

func (ExitCode) RangesDynamicMap

func (it ExitCode) RangesDynamicMap() map[string]interface{}

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) ToPtr

func (it ExitCode) ToPtr() *ExitCode

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

func (ExitCode) ValueInt

func (it ExitCode) ValueInt() int

func (ExitCode) ValueInt16

func (it ExitCode) ValueInt16() int16

func (ExitCode) ValueInt32

func (it ExitCode) ValueInt32() int32

func (ExitCode) ValueInt8

func (it ExitCode) ValueInt8() int8

func (ExitCode) ValueString

func (it ExitCode) ValueString() string

func (ExitCode) ValueUInt16

func (it ExitCode) ValueUInt16() uint16

Jump to

Keyboard shortcuts

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