Documentation
¶
Index ¶
- Constants
- func CheckMapEqual(pre, cur map[string]string) bool
- func CmpBool(a, b bool) int
- func CmpError(err1, err2 error) int
- func CmpFloat64(a, b float64) int
- func CmpInt32(a, b int32) int
- func DeepCopyMap(origin map[string]string) map[string]string
- func EnsureDirectory(dir string) error
- func ExtractMapValued(m map[string]string) []string
- func GenerateHash(data []byte, length int) string
- func GetInt64PointerFromUint64Pointer(v *uint64) (*int64, error)
- func GetOneExistPath(paths []string) string
- func GetStringValueFromMap(labels map[string]string, label string) string
- func GetValueWithDefault(m map[string]string, key, defaultV string) string
- func IntSliceToStringSlice(a []int) []string
- func IsNameEnabled(name string, disabledByDefault sets.String, enableNames []string) bool
- func IsPathExists(path string) bool
- func JsonPathEmpty(str []byte) bool
- func Max(a, b int) int
- func MaxInt64(a, b int64) int64
- func MaxUInt64(a, b uint64) uint64
- func MergeMap(src, override map[string]string) map[string]string
- func Min(a, b int) int
- func MinUInt64(a, b uint64) uint64
- func ParseMapWithPrefix(prefix, selector string) (map[string]string, error)
- func ParseStringToUint64Pointer(s string) (*uint64, error)
- func ParseUint64PointerToString(v *uint64) string
- func RegisterFileEventWatcher(stop <-chan struct{}, fileWatcherInfo FileWatcherInfo) (<-chan struct{}, error)
- func ReleaseUniqueLock(lock *Flock)
- func ToString(in interface{}) string
- func UInt64PointerToFloat64(p *uint64) float64
- func UIntPointerToFloat64(p *uint) float64
- type CappedSmoothWindow
- type CmpFunc
- type FileWatcherInfo
- type Flock
- type MultiSorter
- type ResourceList
- type SmoothWindow
- type SourceList
Constants ¶
const ( FlockCoolingInterval = 6 * time.Second FlockTryLockMaxTimes = 10 )
Variables ¶
This section is empty.
Functions ¶
func CheckMapEqual ¶
func CmpFloat64 ¶
CmpFloat64 compares float64s, placing greater before smaller
func EnsureDirectory ¶
func ExtractMapValued ¶
ExtractMapValued is used to extract value slice from the given map
func GenerateHash ¶
func GetOneExistPath ¶
GetOneExistPath is to get one of exist paths
func GetStringValueFromMap ¶
func GetValueWithDefault ¶
GetValueWithDefault gets value from the given map, and returns default if key not exist
func IntSliceToStringSlice ¶
func IsNameEnabled ¶
IsNameEnabled check if a specified name enabled or not.
func IsPathExists ¶
IsPathExists is to check this path whether exists
func JsonPathEmpty ¶
JsonPathEmpty is used to check whether the given str is empty for json-patch
func ParseMapWithPrefix ¶
ParseMapWithPrefix converts selector string to label map and validates keys and values
func RegisterFileEventWatcher ¶
func RegisterFileEventWatcher(stop <-chan struct{}, fileWatcherInfo FileWatcherInfo) (<-chan struct{}, error)
RegisterFileEventWatcher inotify the given file and report the changed information to the caller through returned channel
func ReleaseUniqueLock ¶
func ReleaseUniqueLock(lock *Flock)
ReleaseUniqueLock release the given file lock
func ToString ¶
func ToString(in interface{}) string
ToString transform to string for better display etc. in log
func UInt64PointerToFloat64 ¶
func UIntPointerToFloat64 ¶
Types ¶
type CappedSmoothWindow ¶
type CappedSmoothWindow struct { sync.Mutex SmoothWindow // contains filtered or unexported fields }
func NewCappedSmoothWindow ¶
func NewCappedSmoothWindow(minStep resource.Quantity, maxStep resource.Quantity, smoothWindow SmoothWindow) *CappedSmoothWindow
NewCappedSmoothWindow creates a capped SmoothWindow, which
func (*CappedSmoothWindow) GetWindowedResources ¶
func (m *CappedSmoothWindow) GetWindowedResources(value resource.Quantity) *resource.Quantity
GetWindowedResources cap the value return by smooth window min to max
type FileWatcherInfo ¶
type Flock ¶
type Flock struct { LockFile string // contains filtered or unexported fields }
func GetUniqueLock ¶
GetUniqueLock is a wrapper function for GetUniqueLockWithTimeout with default configurations
func GetUniqueLockWithTimeout ¶
GetUniqueLockWithTimeout try to acquire file lock returns the lock struct uf success; otherwise returns error
type MultiSorter ¶
type MultiSorter struct {
// contains filtered or unexported fields
}
MultiSorter implements the Sort interface, sorting changes within.
func NewMultiSorter ¶
func NewMultiSorter(cmp ...CmpFunc) *MultiSorter
NewMultiSorter returns a Sorter that sorts using the cmp functions, in order. Call its Sort method to sort the data.
func (*MultiSorter) Sort ¶
func (ms *MultiSorter) Sort(sources SourceList)
Sort sorts the argument slice according to the Less functions passed to NewMultiSorter.
type ResourceList ¶
type ResourceList v1.ResourceList
func (*ResourceList) Set ¶
func (r *ResourceList) Set(value string) error
func (*ResourceList) String ¶
func (r *ResourceList) String() string
func (*ResourceList) Type ¶
func (r *ResourceList) Type() string
type SmoothWindow ¶
type SmoothWindow interface { // GetWindowedResources receives a sample and returns the result after smoothing, // it can return nil if there are not enough samples in this window GetWindowedResources(value resource.Quantity) *resource.Quantity }
SmoothWindow is used to smooth the resource
func NewAverageWithTTLSmoothWindow ¶
func NewAverageWithTTLSmoothWindow(windowSize int, ttl time.Duration, usedMillValue bool) SmoothWindow
NewAverageWithTTLSmoothWindow create a smooth window with ttl and window size, and the window size is the sample count while the ttl is the valid lifetime of each sample, and the usedMillValue means whether calculate the result with milli-value.