Documentation
¶
Overview ¶
Foliage primary statefun system package. Provides shared system functions for statefun packages
Index ¶
- Variables
- func Base64ToStr(base64Encoded string) string
- func BoolToBytes(b bool) []byte
- func BytesToBool(data []byte) bool
- func BytesToFloat64(b []byte) float64
- func BytesToInt64(v []byte) int64
- func CreateDimSizeChannel[T interface{}](maxBufferElements int, onBufferOverflow func()) (in chan T, out chan T)
- func Float64ToBytes(f float64) []byte
- func GetCurrentTimeNs() int64
- func GetEnv[T interface{}](key string, defaultVal T) (value T, err error)
- func GetEnvMustProceed[T interface{}](key string, defaultVal T) T
- func GetHashStr(str string) string
- func GetUniqueStrID() string
- func Int64ToBytes(v int64) []byte
- func IntToStr(i int64) string
- func MapsIntersection[T interface{}](m1 map[string]T, m2 map[string]T, valuesFromMap1 bool) map[string]T
- func MapsUnion[T interface{}](m1 map[string]T, m2 map[string]T) map[string]T
- func MsgOnErrorReturn(retVars ...interface{})
- func SortJSONs(jsonArray []*easyjson.JSON, fields []string) []*easyjson.JSON
- func SortUUIDs(uuids []string, ascending bool) []string
- func StartHeapWatcher(intervalMins float32)
- func Str2Bool(boolStr string) bool
- func Str2Int(s string) int64
- func StrToBase64(xmlText string) string
- func StringToFloat(s string) float64
- func UniqueStrings(input []string) []string
- type FinalFunc
- type FinalFunctions
- type KeyMutex
- type Prometrics
- func (pm *Prometrics) EnsureGaugeVec(id string, metric *prometheus.GaugeVec) (*prometheus.GaugeVec, error)
- func (pm *Prometrics) EnsureGaugeVecSimple(id string, help string, labelNames []string) (*prometheus.GaugeVec, error)
- func (pm *Prometrics) EnsureHistogramVec(id string, metric *prometheus.HistogramVec) (*prometheus.HistogramVec, error)
- func (pm *Prometrics) EnsureHistogramVecSimple(id string, help string, buckets []float64, labelNames []string) (*prometheus.HistogramVec, error)
- func (pm *Prometrics) Exists(id string) bool
- func (pm *Prometrics) GetRoutinesCounter() *RoutinesCounter
- func (pm *Prometrics) Shutdown()
- type RoutinesCounter
- type RoutinesCounterValue
- type TokenBucket
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 BoolToBytes ¶ added in v0.1.6
func BytesToBool ¶ added in v0.1.6
func BytesToFloat64 ¶ added in v0.1.6
func BytesToInt64 ¶
func CreateDimSizeChannel ¶
func CreateDimSizeChannel[T interface{}](maxBufferElements int, onBufferOverflow func()) (in chan T, out chan T)
func Float64ToBytes ¶ added in v0.1.6
func GetCurrentTimeNs ¶
func GetCurrentTimeNs() int64
func GetEnvMustProceed ¶
func GetEnvMustProceed[T interface{}](key string, defaultVal T) T
func GetHashStr ¶
func GetUniqueStrID ¶
func GetUniqueStrID() string
func Int64ToBytes ¶
func MapsIntersection ¶ added in v0.1.3
func MsgOnErrorReturn ¶
func MsgOnErrorReturn(retVars ...interface{})
func StartHeapWatcher ¶ added in v0.1.7
func StartHeapWatcher(intervalMins float32)
func StrToBase64 ¶ added in v0.1.6
func StringToFloat ¶ added in v0.1.6
func UniqueStrings ¶ added in v0.1.6
Types ¶
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.
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
Click to show internal directories.
Click to hide internal directories.