system

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: Apache-2.0 Imports: 24 Imported by: 4

Documentation

Overview

Foliage primary statefun system package. Provides shared system functions for statefun packages

Index

Constants

This section is empty.

Variables

View Source
var (
	PrometricDifferentTypeExistsForIdError = errors.New("metrics with a different type exists for an id")
	PrometricInstanceIsNil                 = errors.New("prometrics instance the method is being call against to is nil")
)

Functions

func Base64ToStr added in v0.1.6

func Base64ToStr(base64Encoded string) string

func BoolToBytes added in v0.1.6

func BoolToBytes(b bool) []byte

func BytesToBool added in v0.1.6

func BytesToBool(data []byte) bool

func BytesToFloat64 added in v0.1.6

func BytesToFloat64(b []byte) float64

func BytesToInt64

func BytesToInt64(v []byte) int64

func CreateDimSizeChannel

func CreateDimSizeChannel[T interface{}](maxBufferElements int, onBufferOverflow func()) (in chan T, out chan T)

func Float64ToBytes added in v0.1.6

func Float64ToBytes(f float64) []byte

func GetCurrentTimeNs

func GetCurrentTimeNs() int64

func GetEnv

func GetEnv[T interface{}](key string, defaultVal T) (value T, err error)

func GetEnvMustProceed

func GetEnvMustProceed[T interface{}](key string, defaultVal T) T

func GetHashStr

func GetHashStr(str string) string

func GetUniqueStrID

func GetUniqueStrID() string

func Int64ToBytes

func Int64ToBytes(v int64) []byte

func IntToStr added in v0.1.6

func IntToStr(i int64) string

func MapsIntersection added in v0.1.3

func MapsIntersection[T interface{}](m1 map[string]T, m2 map[string]T, valuesFromMap1 bool) map[string]T

func MapsUnion added in v0.1.3

func MapsUnion[T interface{}](m1 map[string]T, m2 map[string]T) map[string]T

func MsgOnErrorReturn

func MsgOnErrorReturn(retVars ...interface{})

func SortJSONs added in v0.1.6

func SortJSONs(jsonArray []*easyjson.JSON, fields []string) []*easyjson.JSON

func SortUUIDs added in v0.1.6

func SortUUIDs(uuids []string, ascending bool) []string

func StartHeapWatcher added in v0.1.7

func StartHeapWatcher(intervalMins float32)

func Str2Bool added in v0.1.6

func Str2Bool(boolStr string) bool

func Str2Int

func Str2Int(s string) int64

func StrToBase64 added in v0.1.6

func StrToBase64(xmlText string) string

func StringToFloat added in v0.1.6

func StringToFloat(s string) float64

func UniqueStrings added in v0.1.6

func UniqueStrings(input []string) []string

Types

type FinalFunc added in v0.1.6

type FinalFunc func()

type FinalFunctions added in v0.1.6

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

func NewFinalFunctions added in v0.1.6

func NewFinalFunctions() *FinalFunctions

func (*FinalFunctions) Add added in v0.1.6

func (ff *FinalFunctions) Add(f FinalFunc)

func (*FinalFunctions) Exec added in v0.1.6

func (ff *FinalFunctions) Exec()

type KeyMutex added in v0.1.3

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

KeyMutex provides per-key read-write mutexes with automatic cleanup. Multiple readers can access a key concurrently if no writer holds the lock.

func NewKeyMutex added in v0.1.3

func NewKeyMutex() *KeyMutex

NewKeyMutex constructs a new KeyMutex.

func (*KeyMutex) Lock added in v0.1.3

func (k *KeyMutex) Lock(key interface{})

Lock acquires exclusive (write) lock for the specified key.

func (*KeyMutex) RLock added in v0.1.6

func (k *KeyMutex) RLock(key interface{})

RLock acquires a shared (read) lock for the specified key.

func (*KeyMutex) RUnlock added in v0.1.6

func (k *KeyMutex) RUnlock(key interface{})

RUnlock releases a shared (read) lock for the specified key.

func (*KeyMutex) Unlock added in v0.1.3

func (k *KeyMutex) Unlock(key interface{})

Unlock releases an exclusive (write) lock for the specified key.

type Prometrics added in v0.1.3

type Prometrics struct {
	// contains filtered or unexported fields
}
var (
	GlobalPrometrics *Prometrics
)

func NewPrometrics added in v0.1.3

func NewPrometrics(pattern string, addr string) *Prometrics

func (*Prometrics) EnsureGaugeVec added in v0.1.3

func (pm *Prometrics) EnsureGaugeVec(id string, metric *prometheus.GaugeVec) (*prometheus.GaugeVec, error)

func (*Prometrics) EnsureGaugeVecSimple added in v0.1.3

func (pm *Prometrics) EnsureGaugeVecSimple(id string, help string, labelNames []string) (*prometheus.GaugeVec, error)

func (*Prometrics) EnsureHistogramVec added in v0.1.3

func (pm *Prometrics) EnsureHistogramVec(id string, metric *prometheus.HistogramVec) (*prometheus.HistogramVec, error)

func (*Prometrics) EnsureHistogramVecSimple added in v0.1.3

func (pm *Prometrics) EnsureHistogramVecSimple(id string, help string, buckets []float64, labelNames []string) (*prometheus.HistogramVec, error)

func (*Prometrics) Exists added in v0.1.3

func (pm *Prometrics) Exists(id string) bool

func (*Prometrics) GetRoutinesCounter added in v0.1.3

func (pm *Prometrics) GetRoutinesCounter() *RoutinesCounter

func (*Prometrics) Shutdown added in v0.1.6

func (pm *Prometrics) Shutdown()

type RoutinesCounter added in v0.1.3

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

func (*RoutinesCounter) Read added in v0.1.3

func (rc *RoutinesCounter) Read(f func(key string, value int64) bool)

func (*RoutinesCounter) Started added in v0.1.3

func (rc *RoutinesCounter) Started(routineTypeName string)

func (*RoutinesCounter) Stopped added in v0.1.3

func (rc *RoutinesCounter) Stopped(routineTypeName string)

type RoutinesCounterValue added in v0.1.3

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

type TokenBucket added in v0.1.6

type TokenBucket struct {
	Capacity int
	// contains filtered or unexported fields
}

func NewTokenBucket added in v0.1.6

func NewTokenBucket(cap int) *TokenBucket

func (*TokenBucket) GetLoadPercentage added in v0.1.6

func (tb *TokenBucket) GetLoadPercentage() float64

func (*TokenBucket) Release added in v0.1.6

func (tb *TokenBucket) Release()

func (*TokenBucket) TryAcquire added in v0.1.6

func (tb *TokenBucket) TryAcquire() bool

Jump to

Keyboard shortcuts

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