Something went wrong. Try again.
Metric and Time-Series Engine: A Minimal Archiving Time Series Storage Service
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182package types
import ( "fmt"
"github.com/cespare/xxhash/v2")
// MetricID is the internal immutable 64-bit identifier mapped from string tags.type MetricID int64
// HashMetricID computes a deterministic 63-bit positive MetricID from host, service, and optional tags// using xxHash64. Guarantees identical IDs across independent instances, offline converters, and restarts.func HashMetricID(host, service, tags string) MetricID { key := host + "\x00" + service if tags != "" { key += "\x00" + tags } return MetricID(xxhash.Sum64String(key) & 0x7FFFFFFFFFFFFFFF)}
// BucketID represents a fixed coarse time epoch (e.g., unix_seconds / bucket_duration_seconds).type BucketID uint32
// DataPoint is the fundamental unboxed numeric telemetry point.// Fits in exactly 24 contiguous bytes (3 x 8 bytes).type DataPoint struct { MetricID MetricID // 8 bytes Timestamp int64 // 8 bytes (Unix timestamp in milliseconds) Value float64 // 8 bytes (Float64 value)}
func (dp DataPoint) String() string { return fmt.Sprintf("DataPoint(metric=%d, ts=%d, val=%f)", dp.MetricID, dp.Timestamp, dp.Value)}
// SeriesMetadata represents the human-readable metadata associated with a MetricID.type SeriesMetadata struct { MetricID MetricID Host string Service string Tags string // Canonical sorted key-value pairs or JSON string}
// BucketState represents the lifecycle status of a time bucket.type BucketState string
const ( BucketStateActive BucketState = "ACTIVE" BucketStateSealed BucketState = "SEALED" BucketStateCommitted BucketState = "COMMITTED" BucketStateCompacted BucketState = "COMPACTED")
// BucketManifest records the immutable cold Parquet metadata.type BucketManifest struct { BucketID BucketID StorageKey string MinTS int64 MaxTS int64 RecordCount int64 SizeBytes int64 State BucketState}
// SeriesFilter represents query constraints to resolve matching MetricIDs.type SeriesFilter struct { HostRegex string ServiceRegex string TagsExact map[string]string}
// BucketIterator traverses all points within a single sealed time bucket.type BucketIterator interface { Next() bool MetricID() MetricID Timestamp() int64 Value() float64 Error() error Close() error}