Documentation ¶
Index ¶
- Constants
- Variables
- func AddHeaders(exist http.Header, addons []string)
- func CollectLog(collector, home, user, instanceID, inspectionID string, begin, end time.Time) error
- func DirSize(dir string) (int64, error)
- func ElemInRange(value reflect.Value, l int64, h int64) bool
- func FlatMap(value reflect.Value, tagPath string) reflect.Value
- func Len(value reflect.Value) int
- func MatchPrefixs(str string, prefixs []string) bool
- func MustCmpDuration(left string, right string) int
- func MustCmpReadableSize(left string, right string) int
- func ParseReadableDuration(s string) (time.Duration, error)
- func ParseTime(s string) (time.Time, error)
- func RecursiveIfBoolValueExist(reflectV reflect.Value, value bool) bool
- func RecursiveSetBoolValue(reflectV reflect.Value, value bool)
- func RunPortForward(kubeconfig, namespace, podName string, port int) (stopChannel chan struct{}, localPort int, err error)
- func TrimLeftSpace(s string) string
- func ValueToBool(value reflect.Value) bool
- func ValueToFloat(value reflect.Value) float64
- func ValueToInt(value reflect.Value) int64
- func ValueToString(value reflect.Value) string
- func VisitByTagPath(node reflect.Value, tags []string, idx int) reflect.Value
- type ReadableSize
- type Token
- type TokenLimiter
Constants ¶
const B uint64 = UNIT
const BinaryDataMagnitude uint64 = 1024
const GIB uint64 = MIB * BinaryDataMagnitude
const KIB uint64 = UNIT * BinaryDataMagnitude
const MIB uint64 = KIB * BinaryDataMagnitude
const PIB uint64 = TIB * BinaryDataMagnitude
const TIB uint64 = GIB * BinaryDataMagnitude
const UNIT uint64 = 1
Variables ¶
var DeprecatedTags = map[string]string{
"enable-streaming": "EnableStreaming",
}
Functions ¶
func AddHeaders ¶ added in v1.4.0
AddHeaders parse headers like "a: b" and add them to exist header
func CollectLog ¶
CollectLog collects logs
func FlatMap ¶
FlatMap iterate all map element with the given tagPath, return a slice contain all visited elements. the given value should be a map type.
func MatchPrefixs ¶ added in v1.6.0
func MustCmpDuration ¶
MustCmpDuration return 0, -1, 1; 0 left == right, 1 left > right, -1 left < right Only use this method in gengine
func MustCmpReadableSize ¶
MustCmpReadableSize return 0, -1, 1; 0 left == right, 1 left > right, -1 left < right Only use this method in gengine
func ParseReadableDuration ¶
ParseReadableDuration is copied from prometheus ParseDuration function.
func ParseTime ¶
ParseTime converts a string to time.Time, ported from Prometheus: web/api/v1/api.go
func RecursiveSetBoolValue ¶
func RunPortForward ¶ added in v1.4.0
func TrimLeftSpace ¶ added in v1.4.0
TrimLeftSpace trim all left space
func ValueToBool ¶
func ValueToFloat ¶
func ValueToInt ¶
func ValueToString ¶
ValueToString return the parsed string value for other type
Types ¶
type ReadableSize ¶
type ReadableSize = uint64
func ParseReadableSize ¶
func ParseReadableSize(s string) (ReadableSize, error)
type TokenLimiter ¶
type TokenLimiter struct {
// contains filtered or unexported fields
}
TokenLimiter is used to limit the number of concurrent tasks.
func NewTokenLimiter ¶
func NewTokenLimiter(count uint) *TokenLimiter
NewTokenLimiter creates a TokenLimiter with count tokens.