util

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TierBegin = 0
	Hot       = 1
	Warm      = 2
	Cold      = 3
	Moving    = 4
	TierEnd   = 5
)
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)))
)

the measurement name length should consider MeasurementVersionLength

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

eg, version is:_0000

View Source
const RowsNumPerFragment int = 8192

Variables

This section is empty.

Functions

func AllocSlice added in v1.1.0

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

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 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 HttpError added in v1.0.0

func HttpError(w http.ResponseWriter, errmsg string, code int)

httpError writes an error to the client in a standard format.

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 IsObjectNil

func IsObjectNil(obj interface{}) bool

func MaxUint32 added in v1.1.0

func MaxUint32(x, y uint32) uint32

func MemorySet added in v1.1.0

func MemorySet(buf []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 NumberOfTrailingZeros added in v1.1.0

func NumberOfTrailingZeros(num uint64) int
func Search(begin, n int, f func(int) bool) int

func SetLogger

func SetLogger(lg *zap.Logger)

func Str2bytes added in v1.1.0

func Str2bytes(s string) []byte

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

Types

type Corrector

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

func NewCorrector

func NewCorrector(intMin int64, floatMin float64) *Corrector

func (*Corrector) Float64

func (c *Corrector) Float64(v *float64, def float64)

func (*Corrector) Int

func (c *Corrector) Int(v *int, def int)

func (*Corrector) String

func (c *Corrector) String(v *string, def string)

func (*Corrector) TomlDuration

func (c *Corrector) TomlDuration(v *toml.Duration, def toml.Duration)

func (*Corrector) TomlSize

func (c *Corrector) TomlSize(v *toml.Size, def toml.Size)

func (*Corrector) Uint64

func (c *Corrector) Uint64(v *uint64, def uint64)

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) 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) 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