Files
qb/database/metric.go

44 lines
705 B
Go
Raw Normal View History

2026-02-10 14:02:11 +00:00
package database
import (
2026-05-14 16:06:37 +03:00
"gordenko.dev/dima/qb"
2026-02-10 14:02:11 +00:00
)
// METRIC
type _metric struct {
2026-05-14 16:06:37 +03:00
MetricType qb.MetricType
FracDigits byte
LastPageNo uint32
SinceValue float64
Since uint32
UntilValue float64
Until uint32
Timestamps qb.TimestampCompressor
Values qb.ValueCompressor
2026-02-10 14:02:11 +00:00
}
func (s *_metric) ReinitBy(timestamp uint32, value float64) {
2026-05-21 23:38:52 +03:00
s.Timestamps.Renew()
s.Values.Renew()
2026-02-10 14:02:11 +00:00
2026-05-21 23:38:52 +03:00
s.Timestamps.Append(timestamp)
s.Values.Append(value)
2026-02-10 14:02:11 +00:00
2026-05-21 23:38:52 +03:00
s.Since = timestamp
s.SinceValue = value
s.Until = timestamp
s.UntilValue = value
2026-02-10 14:02:11 +00:00
}
func (s *_metric) DeleteMeasures() {
2026-05-21 23:38:52 +03:00
s.Timestamps.Renew()
s.Values.Renew()
2026-02-10 14:02:11 +00:00
s.LastPageNo = 0
s.Since = 0
s.SinceValue = 0
s.Until = 0
s.UntilValue = 0
}