Documentation
¶
Index ¶
- func BinSearchInRange(from, to int, fn func(i int) bool) int
- func ByteToStringUnsafe(b []byte) string
- func CollapseErrors(errs []error) error
- func DeduplicateErrors(errs []error) error
- func DurationToUnit(durationVal time.Duration, unit string) float64
- func EnsureSliceSize[T any](src []T, size int) []T
- func Float64ToPrec(val float64, prec uint32) float64
- func IdxFill(n int) []int
- func IdxShuffle(n int) []int
- func IsCancelled(ctx context.Context) bool
- func IsRecoveredPanicError(e error) bool
- func MsTsToESFormat(ts uint64) string
- func MustSyncPath(path string)
- func ParseDuration(esDuration string) (time.Duration, error)
- func Recover(metric prometheus.Counter, err error)
- func RecoverToError(panicData any, metric prometheus.Counter) error
- func RunEvery(done <-chan struct{}, runInterval time.Duration, actionFn func())
- func SizeStr(bytes uint64) string
- func SizeToUnit(sizeVal uint64, unit string) float64
- func StringToByteUnsafe(str string) []byte
- func ZapDurationWithPrec(key string, dur time.Duration, unit string, prec uint32) zap.Field
- func ZapFloat64WithPrec(key string, val float64, prec uint32) zap.Field
- func ZapMsTsAsESTimeStr(key string, ts uint64) zap.Field
- func ZapUint64AsSizeStr(key string, val uint64) zap.Field
- type Bitmask
- type BufferPool
- type ReallocSolver
- type ReallocSolverOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteToStringUnsafe ¶
func CollapseErrors ¶
CollapseErrors combines errors and writes repeats of each.
func DeduplicateErrors ¶
DeduplicateErrors deduplicates errors.
func DurationToUnit ¶
DurationToUnit converts duration to unit and returns as float64.
func EnsureSliceSize ¶
func Float64ToPrec ¶
Float64ToPrec formats float64 by removing numberics after prec digit.
func IdxShuffle ¶
func IsCancelled ¶
IsCancelled is a faster way to check if the context has been canceled, compared to ctx.Err() != nil
func IsRecoveredPanicError ¶
func MsTsToESFormat ¶
MsTsToESFormat converts timestamp in milliseconds to ES time format string.
func MustSyncPath ¶
func MustSyncPath(path string)
func Recover ¶
func Recover(metric prometheus.Counter, err error)
func RecoverToError ¶
func RecoverToError(panicData any, metric prometheus.Counter) error
func SizeToUnit ¶
SizeToUnit converts size in bytes to unit and returns as float64.
func StringToByteUnsafe ¶
func ZapDurationWithPrec ¶
ZapDurationWithPrec converts duration to unit and forms float64 zap.Field with removed numerics after prec digit.
func ZapFloat64WithPrec ¶
ZapFloat64WithPrec forms float64 zap.Field with removed numerics after prec digit.
func ZapMsTsAsESTimeStr ¶
ZapMsTsAsESTimeStr converts timestamp in milliseconds to ES time format string and forms string zap.Field.
Types ¶
type Bitmask ¶
type Bitmask struct {
// contains filtered or unexported fields
}
func LoadBitmask ¶
func NewBitmask ¶
func (*Bitmask) GetBitmaskBinary ¶
type BufferPool ¶ added in v0.59.0
type BufferPool struct {
// contains filtered or unexported fields
}
func (*BufferPool) Get ¶ added in v0.59.0
func (q *BufferPool) Get() *bytespool.Buffer
func (*BufferPool) Put ¶ added in v0.59.0
func (q *BufferPool) Put(b *bytespool.Buffer)
type ReallocSolver ¶
type ReallocSolver struct {
// contains filtered or unexported fields
}
func NewReallocSolver ¶
func NewReallocSolver(opts ...ReallocSolverOpts) ReallocSolver
func (*ReallocSolver) ReallocParams ¶
func (s *ReallocSolver) ReallocParams(curLen, curCap int) (int, bool)
type ReallocSolverOpts ¶
type ReallocSolverOpts func(*ReallocSolver)
func ReallocSolverLabel ¶
func ReallocSolverLabel(label string) ReallocSolverOpts
func ReallocSolverSize ¶
func ReallocSolverSize(statSize int) ReallocSolverOpts