Versions in this module Expand all Collapse all v0 v0.1.3 Aug 2, 2022 v0.1.2 Jul 29, 2022 Changes in this version + const After + const Before + const Inside + func GetCurrentMilliseconds(startTime time.Time) int64 + type AddBucketFunc func(gauge model.InstanceGauge, bucket *Bucket) int64 + type Bucket struct + func (b *Bucket) AddMetric(dimension int, value int64) int64 + func (b *Bucket) CalcBucketMetrics(dimensions []int, startTime int64, endTime int64, rangeType IntervalType) []int64 + func (b *Bucket) GetMetric(dimension int) int64 + func (b *Bucket) SetMetric(dimension int, value int64) + type BucketOperation func(bucket *Bucket) int64 + type GaugeOperation struct + Gauge model.InstanceGauge + Operation AddBucketFunc + type IntervalType int + const IncludeBoth + const IncludeEnd + const IncludeStart + func (i IntervalType) String() string + type ResMetricArray struct + func NewResMetricArray(metricSize int) *ResMetricArray + func (r *ResMetricArray) AddMetric(dimension int, value int64) int64 + func (r *ResMetricArray) GetMetric(dimension int) int64 + func (r *ResMetricArray) SetMetric(dimension int, value int64) + func (r *ResMetricArray) SwapMetric(dimension int, newValue int64) int64 + type SliceWindow struct + Lock *sync.Mutex + PeriodStartTime int64 + Type string + func NewSliceWindow(typ string, bucketCount int, bucketInterval time.Duration, metricSize int, ...) *SliceWindow + func (s *SliceWindow) AddGauge(gauge model.InstanceGauge, operation AddBucketFunc) int64 + func (s *SliceWindow) AddGaugeAdvance(gauge model.InstanceGauge, operation AddBucketFunc) (int64, int64) + func (s *SliceWindow) AddGaugeByValue(value int64, curTime time.Time) int64 + func (s *SliceWindow) AddGaugeByValueByMillTime(value int64, curTime int64) int64 + func (s *SliceWindow) AddHistoryMetric(now time.Time, operation BucketOperation) (int64, bool) + func (s *SliceWindow) AddHistoryMetricByMillTime(now int64, operation BucketOperation) (int64, bool) + func (s *SliceWindow) CalcMetrics(dimension int, timeRange *TimeRange) int64 + func (s *SliceWindow) CalcMetricsInMultiDimensions(dimensions []int, timeRange *TimeRange) []int64 + func (s *SliceWindow) CalcStartTime(curTime int64) int64 + func (s *SliceWindow) GetBucketInterval() time.Duration + func (s *SliceWindow) GetLastUpdateTime() int64 + func (s *SliceWindow) IsMetricUpdate() bool + func (s *SliceWindow) SetLastReadTime() + func (s *SliceWindow) SetPeriodStart(now int64) + type TimeRange struct + End time.Time + Start time.Time + Type IntervalType + func (t *TimeRange) IsTimeInBucket(value time.Time) int