Documentation ¶
Index ¶
- Constants
- Variables
- func AddDebugFlag()
- func AddLogLevelFlag()
- func AddLogPathFlag()
- func AddModels(parent *spec.Models, child *spec.Models)
- func ArchiveTar(file string, writer *tar.Writer) error
- func CheckPortInUse(port string) bool
- func ConvertSpecToModels(commandSpec spec.ExpModelCommandSpec, prepare spec.ExpPrepareModel, ...) *spec.Models
- func CreateYamlFile(models *spec.Models, specFile string) error
- func Curl(ctx context.Context, url string) (string, error, int)
- func Debugf(uid, funcName, msg string)
- func Errorf(uid, funcName, msg string)
- func Fatalf(uid, funcName, msg string)
- func GenerateContainerId() string
- func GenerateExecID() string
- func GenerateUid() (string, error)
- func GetBinPath() string
- func GetLibHome() string
- func GetLogFile(programType int) (string, error)
- func GetLogPath(programType int) (string, error)
- func GetNohupOutput(programType int, logFileName string) string
- func GetProgramParentPath() string
- func GetProgramPath() string
- func GetRunFuncName() string
- func GetSpecifyingUserHome(username string) string
- func GetUnusedPort() (int, error)
- func GetUserHome() string
- func GetYamlHome() string
- func Hold(hooks ...ShutdownHook)
- func Infof(uid, funcName, msg string)
- func InitLog(programType int)
- func IsDir(path string) bool
- func IsExist(fileName string) bool
- func IsNil(i interface{}) bool
- func MarshalModelSpec(models *spec.Models, writer io.Writer) error
- func MergeModels(models ...*spec.Models) *spec.Models
- func Panicf(uid, funcName, msg string)
- func ParseIntegerListToStringSlice(flagName, flagValue string) ([]string, error)
- func ParseSpecsToModel(file string, executor spec.Executor) (*spec.Models, error)
- func PostCurl(url string, body []byte, contentType string) (string, error, int)
- func Remove(items []string, idx int) []string
- func RemoveDuplicates(items []string) []string
- func Tracef(uid, funcName, msg string)
- func Warnf(uid, funcName, msg string)
- type ShutdownHook
Constants ¶
const ( Blade = 1 Bin = 2 Custom = 3 )
const BladeLog = "chaosblade.log"
Variables ¶
var ( Debug bool LogPath string LogLevel string )
Functions ¶
func AddDebugFlag ¶
func AddDebugFlag()
func AddLogLevelFlag ¶
func AddLogLevelFlag()
func AddLogPathFlag ¶
func AddLogPathFlag()
func CheckPortInUse ¶
CheckPortInUse returns true if the port is in use, otherwise returns false.
func ConvertSpecToModels ¶
func ConvertSpecToModels(commandSpec spec.ExpModelCommandSpec, prepare spec.ExpPrepareModel, scope string) *spec.Models
ConvertSpecToModels converts the spec.ExpModelCommandSpec to spec.Models
func CreateYamlFile ¶
CreateYamlFile converts the spec.Models to spec file
func GenerateExecID ¶
func GenerateExecID() string
func GetLogPath ¶
func GetNohupOutput ¶
GetNohupOutput
func GetProgramParentPath ¶
func GetProgramParentPath() string
GetProgramParentPath returns the parent directory end with /
func GetRunFuncName ¶
func GetRunFuncName() string
func GetSpecifyingUserHome ¶
GetSpecifyingUserHome
func GetUnusedPort ¶
func GetYamlHome ¶
func GetYamlHome() string
func Hold ¶
func Hold(hooks ...ShutdownHook)
func MarshalModelSpec ¶
MarshalModelSpec marshals the spec.Models to bytes and output to writer
func ParseIntegerListToStringSlice ¶
ParseIntegerListToStringSlice func parses the multiple integer values to string slice. Support the below formats: 0 | 0,1 | 0,2,3 | 0-3 | 0,2-4 | 0,1,3-5 For example, the flag value is 0,2-3, the func returns []string{"0", "2", "3"}
func ParseSpecsToModel ¶
ParseSpecsToModel parses the yaml file to spec.Models and set the executor to the spec.Models
func RemoveDuplicates ¶
Types ¶
type ShutdownHook ¶
type ShutdownHook interface {
Shutdown() error
}