utils

package
v0.0.0-...-58d9a08 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoPid        = -1
	BuilderSplit = "-"
	CmdSplit     = " && "
	PortSplit    = "-"

	RootName   = "chaosmetad"
	TimeFormat = "2006-01-02 15:04:05"
	RecoverLog = "/tmp/chaosmetad_recover.log"
)

common value

View Source
const (
	DARWIN = "darwin"
	LINUX  = "linux"
)

os

View Source
const (
	MethodValidator = "validator"
	MethodInject    = "inject"
	MethodRecover   = "recover"
)
View Source
const (
	StatusCreated   = "created"
	StatusSuccess   = "success"
	StatusError     = "error"
	StatusDestroyed = "destroyed"
)

task status

View Source
const (
	CtxTraceId = "TraceId"
)

Variables

View Source
var TraceId string

TraceId for command line

Functions

func CheckSpeedValue

func CheckSpeedValue(sp string) error

func CheckTimeValue

func CheckTimeValue(timeStr string) error

func GetBlockKbytes

func GetBlockKbytes(valueStr string) (int64, string, error)

GetBlockKbytes

@Description:
@param valueStr: input value string
@return int64: value in unit kb
@return string: standardized value string
@return error

func GetBytes

func GetBytes(byteStr string) (int64, error)

func GetContainerPath

func GetContainerPath(tool string) string

func GetCtxWithTraceId

func GetCtxWithTraceId(ctx context.Context, traceId string) context.Context

func GetKBytes

func GetKBytes(byteStr string) (int64, error)

func GetNumArrByCount

func GetNumArrByCount(count int, listArr []int) []int

func GetNumArrByList

func GetNumArrByList(listStr string) ([]int, error)

func GetRunPath

func GetRunPath() string

func GetSleepRecoverCmd

func GetSleepRecoverCmd(sleepTime int64, uid string) string

func GetTimeSecond

func GetTimeSecond(timeStr string) (int64, error)

func GetToolDir

func GetToolDir() string

func GetToolPath

func GetToolPath(tool string) string

func GetTraceId

func GetTraceId(ctx context.Context) string

func IsValidUid

func IsValidUid(uid string) error

func NewUid

func NewUid() string

func StrListContain

func StrListContain(arr []string, target string) bool

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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