util

package
v1.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPprofHost = "127.0.0.1"
	StorePprofPort   = "6060"
	SqlPprofPort     = "6061"
	MetaPprofPort    = "6062"
)
View Source
const (
	TierBegin = 0
	Hot       = 1
	Warm      = 2
	Cold      = 3
	Moving    = 4
	TierEnd   = 5
	True      = "true"
	False     = "false"
)
View Source
const (
	BooleanSizeBytes = int(unsafe.Sizeof(false))
	Uint32SizeBytes  = int(unsafe.Sizeof(uint32(0)))
	Uint16SizeBytes  = int(unsafe.Sizeof(uint16(0)))
	Uint64SizeBytes  = int(unsafe.Sizeof(uint64(0)))
	Int16SizeBytes   = int(unsafe.Sizeof(int16(0)))
	Int32SizeBytes   = int(unsafe.Sizeof(int32(0)))
	Int64SizeBytes   = int(unsafe.Sizeof(int64(0)))
	Float32SizeBytes = int(unsafe.Sizeof(float32(0)))
	Float64SizeBytes = int(unsafe.Sizeof(float64(0)))
	Int8SizeBytes    = int(unsafe.Sizeof(int8(0)))

	RowsNumPerFragment                int = 8192
	DefaultMaxRowsPerSegment4TsStore      = 1000
	DefaultMaxRowsPerSegment4ColStore     = RowsNumPerFragment // should be the same as RowsNumPerFragment@colstore
	DefaultMaxSegmentLimit4ColStore       = 256 * 1024
	DefaultMaxChunkMetaItemSize           = 256 * 1024
	DefaultMaxChunkMetaItemCount          = 512
	CompressModMaxChunkMetaItemCount      = 16

	NonStreamingCompact               = 2
	StreamingCompact                  = 1
	AutoCompact                       = 0
	DefaultExpectedSegmentSize uint32 = 8 * 1024 * 1024
	DefaultFileSizeLimit              = 8 * 1024 * 1024 * 1024

	DefaultEntryLogSizeLimit = 20 * 1024 * 1024 * 1024
)

the measurement name length should consider MeasurementVersionLength

View Source
const MaxMeasurementLengthWithVersion = 255
View Source
const MeasurementVersionLength = 5

eg, version is:_0000

Variables

This section is empty.

Functions

func AllocSlice added in v1.1.0

func AllocSlice[T allocItem](data []T, size int) ([]T, []T)

func Bool2str added in v1.3.0

func Bool2str(b bool) string

func BooleanSlice2byte added in v1.1.0

func BooleanSlice2byte(b []bool) []byte

func Bytes2BooleanSlice added in v1.1.0

func Bytes2BooleanSlice(b []byte) []bool

func Bytes2Float32Slice added in v1.1.0

func Bytes2Float32Slice(b []byte) []float32

func Bytes2Float64Slice added in v1.1.0

func Bytes2Float64Slice(b []byte) []float64

func Bytes2Int16Slice added in v1.1.0

func Bytes2Int16Slice(b []byte) []int16

func Bytes2Int32Slice added in v1.1.0

func Bytes2Int32Slice(b []byte) []int32

func Bytes2Int64Slice added in v1.1.0

func Bytes2Int64Slice(b []byte) []int64

func Bytes2Int8Slice added in v1.1.0

func Bytes2Int8Slice(b []byte) []int8

func Bytes2Uint16Slice added in v1.1.0

func Bytes2Uint16Slice(b []byte) []uint16

func Bytes2Uint32Slice added in v1.1.0

func Bytes2Uint32Slice(b []byte) []uint32

func Bytes2Uint64Slice added in v1.1.0

func Bytes2Uint64Slice(b []byte) []uint64

func Bytes2str added in v1.1.0

func Bytes2str(b []byte) string

func CeilToPower2 added in v0.2.0

func CeilToPower2(num uint64) uint64

func DivisionCeil added in v1.3.0

func DivisionCeil(dividend, divisor int) int

func Float32Slice2byte added in v1.1.0

func Float32Slice2byte(b []float32) []byte

func Float64Slice2byte added in v1.1.0

func Float64Slice2byte(b []float64) []byte

func Float64ToUint64 added in v1.1.0

func Float64ToUint64(v float64) uint64

func Include added in v1.0.0

func Include(slice []uint64, s uint64) bool

Include returns true or false if given array is in slice.

func IndexOf added in v1.0.0

func IndexOf(slice []uint64, s uint64) int

IndexOf returns index position in slice from given array If value is -1, the string does not found.

func Int16Slice2byte added in v1.1.0

func Int16Slice2byte(b []int16) []byte

func Int32Slice2byte added in v1.1.0

func Int32Slice2byte(b []int32) []byte

func Int64Slice2byte added in v1.1.0

func Int64Slice2byte(b []int64) []byte

func IntLimit added in v1.0.0

func IntLimit(min, max int, v int) int

func IntersectSortedSliceInt added in v1.4.0

func IntersectSortedSliceInt(slice1, slice2 []int) []int

func IsHot added in v1.4.0

func IsHot(tier uint64) bool

func IsObjectNil

func IsObjectNil(obj interface{}) bool

func Max added in v1.4.0

func Max[T NumberInt](x, y T) T

func MaxUint32 added in v1.1.0

func MaxUint32(x, y uint32) uint32

func MemorySet added in v1.1.0

func MemorySet(buf []byte, val byte)

func Min added in v1.1.0

func Min(x, y int) int

func MinUint32 added in v1.2.0

func MinUint32(x, y uint32) uint32

func MustClose

func MustClose(obj io.Closer)

func MustRun added in v1.3.0

func MustRun(fn func() error)

func NumberOfTrailingZeros added in v1.1.0

func NumberOfTrailingZeros(num uint64) int

func OpenPprofServer added in v1.3.0

func OpenPprofServer(host, port string)

func PaddingZeroBuffer added in v1.3.0

func PaddingZeroBuffer(out []byte, size int) []byte
func Search(begin, n int, f func(int) bool) int

func SetLogger

func SetLogger(lg *zap.Logger)

func SliceSplitFunc added in v1.4.0

func SliceSplitFunc[E any](s []E, filter func(*E) bool) ([]E, []E)

func Str2bytes added in v1.1.0

func Str2bytes(s string) []byte

func TickerRun added in v1.4.0

func TickerRun(d time.Duration, stopSignal <-chan struct{}, onTick func(), onStop func())

func TimeCost added in v1.0.0

func TimeCost(option string) func()

func Uint16Slice2byte added in v1.1.0

func Uint16Slice2byte(b []uint16) []byte

func Uint32Slice2byte added in v1.1.0

func Uint32Slice2byte(b []uint32) []byte

func Uint64Slice2byte added in v1.1.0

func Uint64Slice2byte(b []uint64) []byte

func Uint64ToFloat64 added in v1.1.0

func Uint64ToFloat64(v uint64) float64

func UnionSortedSliceInt added in v1.4.0

func UnionSortedSliceInt(slice1, slice2 []int) []int

Types

type BasicType added in v1.3.0

type BasicType interface {
	int64 | float64 | bool | string
}

type ConcurrentRunner added in v1.4.0

type ConcurrentRunner[T any] struct {
	// contains filtered or unexported fields
}

func NewConcurrentRunner added in v1.4.0

func NewConcurrentRunner[T any](queues []*Queue[T], processors []Processor) *ConcurrentRunner[T]

func (*ConcurrentRunner[T]) Close added in v1.4.0

func (runner *ConcurrentRunner[T]) Close()

Close called after Stop

func (*ConcurrentRunner[T]) Schedule added in v1.4.0

func (runner *ConcurrentRunner[T]) Schedule(hash uint64, v *T)

func (*ConcurrentRunner[T]) Size added in v1.4.0

func (runner *ConcurrentRunner[T]) Size() int

func (*ConcurrentRunner[T]) Stop added in v1.4.0

func (runner *ConcurrentRunner[T]) Stop()

type ExceptBool added in v1.3.0

type ExceptBool interface {
	int64 | float64 | string
}

type ExceptString added in v1.3.0

type ExceptString interface {
	int64 | float64 | bool
}

type NumberInt added in v1.4.0

type NumberInt interface {
	int | int8 | int32 | int64 | uint8 | uint32 | uint64
}

type NumberOnly added in v1.3.0

type NumberOnly interface {
	int64 | float64
}

type Processor added in v1.4.0

type Processor interface {
	Run()

	// Stop called before Close
	Stop()
	Close()
}

type Queue added in v1.4.0

type Queue[T any] struct {
	// contains filtered or unexported fields
}

func NewQueue added in v1.4.0

func NewQueue[T any](size int) *Queue[T]

func (*Queue[T]) Close added in v1.4.0

func (q *Queue[T]) Close()

func (*Queue[T]) Pop added in v1.4.0

func (q *Queue[T]) Pop() (*T, bool)

func (*Queue[T]) Push added in v1.4.0

func (q *Queue[T]) Push(v *T)

type Reference added in v1.4.0

type Reference struct {
	// contains filtered or unexported fields
}

func (*Reference) Ref added in v1.4.0

func (r *Reference) Ref()

func (*Reference) Unref added in v1.4.0

func (r *Reference) Unref()

func (*Reference) Wait added in v1.4.0

func (r *Reference) Wait()

type Signal added in v1.2.0

type Signal struct {
	// contains filtered or unexported fields
}

func NewSignal added in v1.2.0

func NewSignal() *Signal

func (*Signal) C added in v1.2.0

func (s *Signal) C() chan struct{}

func (*Signal) Close added in v1.2.0

func (s *Signal) Close()

func (*Signal) CloseOnce added in v1.4.0

func (s *Signal) CloseOnce(onClose func())

func (*Signal) Opening added in v1.2.0

func (s *Signal) Opening() bool

func (*Signal) ReOpen added in v1.2.0

func (s *Signal) ReOpen()

type TimeRange added in v1.1.0

type TimeRange struct {
	Min, Max int64
}

func (TimeRange) Contains added in v1.3.0

func (t TimeRange) Contains(min, max int64) bool

func (TimeRange) Overlaps added in v1.1.0

func (t TimeRange) Overlaps(min, max int64) bool

type TimerPool added in v1.1.0

type TimerPool struct {
	// contains filtered or unexported fields
}

func NewTimePool added in v1.1.0

func NewTimePool() *TimerPool

func (*TimerPool) GetTimer added in v1.1.0

func (p *TimerPool) GetTimer(timeout time.Duration) *time.Timer

func (*TimerPool) PutTimer added in v1.1.0

func (p *TimerPool) PutTimer(timer *time.Timer)

Directories

Path Synopsis
lifted
bytebufferpool
Package bytebufferpool implements a pool of byte buffers with anti-fragmentation protection.
Package bytebufferpool implements a pool of byte buffers with anti-fragmentation protection.
encoding/simple8b
Package simple8b implements the 64bit integer encoding algoritm as published by Ann and Moffat in "Index compression using 64-bit words", Softw.
Package simple8b implements the 64bit integer encoding algoritm as published by Ann and Moffat in "Index compression using 64-bit words", Softw.
go-bitstream
Package bitstream is a simple wrapper around a io.Reader and io.Writer to provide bit-level access to the stream.
Package bitstream is a simple wrapper around a io.Reader and io.Writer to provide bit-level access to the stream.
hashicorp/go-msgpack/codec
High Performance, Feature-Rich Idiomatic Go encoding library for msgpack and binc .
High Performance, Feature-Rich Idiomatic Go encoding library for msgpack and binc .
hashicorp/serf/testutil/retry
Package retry provides support for repeating operations in tests.
Package retry provides support for repeating operations in tests.
protobuf/proto
Package proto converts data structures to and from the wire format of protocol buffers.
Package proto converts data structures to and from the wire format of protocol buffers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL