Documentation
¶
Index ¶
- Constants
- Variables
- func CheckIPProtocols(p string) bool
- func CheckIPs(i string) bool
- func CheckPercent(p string) bool
- func CheckPorts(p string) bool
- func CreateGrpcConnection(ctx context.Context, c client.Client, pod *v1.Pod, port int) (*grpc.ClientConn, error)
- func CreateTempFile(path string) (string, error)
- func EncodeClkIds(clkIds []string) (uint64, error)
- func ExecuteCmd(cmdStr string) (string, error)
- func ExitWithError(code int, err error)
- func ExitWithMsg(code int, msg string)
- func FxNewAppWithoutLog(opts ...fx.Option) *fx.App
- func GetDiskTotalSize(path string) (total uint64, err error)
- func GetProgramPath() string
- func GetRootDevice() (string, error)
- func IPToCidr(ip string) string
- func NormalExit(msg string)
- func ParseUnit(s string) (uint64, error)
- func RandomStringWithCharset(length int) string
- func RemoveDuplicateElement(languages []string) []string
- func ResolveCidr(name string) ([]string, error)
- func ResolveCidrs(names []string) ([]string, error)
- func SetRuntimeEnv() error
- func TimeoutClientInterceptor(ctx context.Context, method string, req, reply interface{}, ...) error
- func TimeoutServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- type Command
- type CommandPools
- type CommandRunner
- type DdArgBlock
- type Edge
- type Graph
Constants ¶
const ( ExitSuccess = iota ExitError ExitBadConnection ExitInterrupted ExitIO ExitBadArgs = 128 )
http://tldp.org/LDP/abs/html/exitcodes.html
const DefaultRPCTimeout = 60 * time.Second
DefaultRPCTimeout specifies default timeout of RPC between controller and chaos-operator
Variables ¶
var PrintFxLog bool
var RPCTimeout = DefaultRPCTimeout
RPCTimeout specifies timeout of RPC between controller and chaos-operator
Functions ¶
func CheckIPProtocols ¶
func CheckPercent ¶
func CheckPorts ¶
func CreateGrpcConnection ¶
func CreateGrpcConnection(ctx context.Context, c client.Client, pod *v1.Pod, port int) (*grpc.ClientConn, error)
CreateGrpcConnection create a grpc connection with given port
func CreateTempFile ¶ added in v1.0.0
CreateTempFile will create a temp file in current directory.
func EncodeClkIds ¶
EncodeClkIds will convert array of clk ids into a mask
func ExecuteCmd ¶ added in v1.2.0
func ExitWithError ¶ added in v1.0.0
ExitWithError exits with error
func ExitWithMsg ¶ added in v1.0.0
ExitWithMsg exits with error message
func FxNewAppWithoutLog ¶ added in v1.0.0
FxNewAppWithoutLog returns fx App without log
func GetDiskTotalSize ¶ added in v1.0.0
GetDiskTotalSize returns the total bytes in disk
func GetRootDevice ¶ added in v1.0.0
GetRootDevice returns the device which "/" mount on.
func ParseUnit ¶ added in v1.0.0
ParseUnit parse a digit with unit such as "K" , "KiB", "KB", "c", "MiB", "MB", "M". If input string is a digit without unit , it will be regarded as a digit with unit M(1024*1024 bytes).
func RandomStringWithCharset ¶ added in v1.0.0
func RemoveDuplicateElement ¶
func ResolveCidr ¶
ResolveCidr converts cidr/ip/domain into cidr
func ResolveCidrs ¶
ResolveCidrs converts multiple cidrs/ips/domains into cidr
func SetRuntimeEnv ¶ added in v1.0.0
func SetRuntimeEnv() error
func TimeoutClientInterceptor ¶
func TimeoutClientInterceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
TimeoutClientInterceptor wraps the RPC with a timeout.
func TimeoutServerInterceptor ¶
func TimeoutServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
TimeoutServerInterceptor ensures the context is intact before handling over the request to application.
Types ¶
type Command ¶ added in v1.0.2
type Command struct {
Name string
}
func (Command) GetCmdArgs ¶ added in v1.4.0
type CommandPools ¶ added in v1.4.0
type CommandPools struct {
// contains filtered or unexported fields
}
CommandPools is a group of commands runner
func NewCommandPools ¶ added in v1.4.0
NewCommandPools returns a new CommandPools
func (*CommandPools) Close ¶ added in v1.4.0
func (p *CommandPools) Close()
func (*CommandPools) Process ¶ added in v1.4.0
func (p *CommandPools) Process(name string, args []string) ([]byte, error)
func (*CommandPools) Start ¶ added in v1.4.0
func (p *CommandPools) Start(runner *CommandRunner)
Start command async.
func (*CommandPools) Wait ¶ added in v1.4.0
func (p *CommandPools) Wait()
type CommandRunner ¶ added in v1.4.0
func NewCommandRunner ¶ added in v1.4.0
func NewCommandRunner(name string, args []string) *CommandRunner
func (*CommandRunner) WithOutputHandler ¶ added in v1.4.0
func (r *CommandRunner) WithOutputHandler( handler func([]byte, error, chan interface{}), outputChanel chan interface{}, ) *CommandRunner
type DdArgBlock ¶ added in v1.0.0
DdArgBlock is command arg for dd. BlockSize is bs.Count is count.
func SplitBytesByProcessNum ¶ added in v1.0.0
func SplitBytesByProcessNum(bytes uint64, processNum uint8) ([]DdArgBlock, error)
This func split bytes in to processNum + 1 dd arg blocks. Every ddArgBlock can generate one dd command. If bytes is bigger than processNum M , bytes will be split into processNum dd commands with bs = 1M ,count = bytes/ processNum M. If bytes is not bigger than processNum M , bytes will be split into processNum dd commands with bs = bytes / uint64(processNum) ,count = 1. And one ddArgBlock stand by the rest bytes will also add to the end of slice, even if rest bytes = 0.
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph represents a graph with link list
func (*Graph) Flatten ¶
Flatten flattens the subtree from source (without checking whether it's a tree)