Files
qb/database/metric.go
2026-05-21 23:38:52 +03:00

44 lines
705 B
Go

package database
import (
"gordenko.dev/dima/qb"
)
// METRIC
type _metric struct {
MetricType qb.MetricType
FracDigits byte
LastPageNo uint32
SinceValue float64
Since uint32
UntilValue float64
Until uint32
Timestamps qb.TimestampCompressor
Values qb.ValueCompressor
}
func (s *_metric) ReinitBy(timestamp uint32, value float64) {
s.Timestamps.Renew()
s.Values.Renew()
s.Timestamps.Append(timestamp)
s.Values.Append(value)
s.Since = timestamp
s.SinceValue = value
s.Until = timestamp
s.UntilValue = value
}
func (s *_metric) DeleteMeasures() {
s.Timestamps.Renew()
s.Values.Renew()
s.LastPageNo = 0
s.Since = 0
s.SinceValue = 0
s.Until = 0
s.UntilValue = 0
}