Documentation ¶
Index ¶
- Variables
- func Logger(ctx context.Context) *zap.Logger
- type AggregateInfo
- type DataBackend
- type DataRow
- type LastTimeRow
- type QueriedData
- type RecentlyAggregated
- type SelectedAggregate
- type SensorTailData
- type StationLastTime
- type StationTailInfo
- type TailedStation
- type TimeScaleDBBackend
- func (tsdb *TimeScaleDBBackend) QueryData(ctx context.Context, qp *backend.QueryParams) (*QueriedData, error)
- func (tsdb *TimeScaleDBBackend) QueryRecentlyAggregated(ctx context.Context, stationIDs []int32, windows []time.Duration) (*RecentlyAggregated, error)
- func (tsdb *TimeScaleDBBackend) QueryTail(ctx context.Context, stationIDs []int32) (*SensorTailData, error)
- type TimeScaleDBWindow
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MaxTime = time.Unix(1<<63-62135596801, 999999999) MinTime = time.Time{} )
View Source
var ( Window24h = &TimeScaleDBWindow{Specifier: "24h", Interval: time.Hour * 24} Window6h = &TimeScaleDBWindow{Specifier: "6h", Interval: time.Hour * 6} Window1h = &TimeScaleDBWindow{Specifier: "1h", Interval: time.Hour * 1} Window10m = &TimeScaleDBWindow{Specifier: "10m", Interval: time.Minute * 10} Window1m = &TimeScaleDBWindow{Specifier: "1m", Interval: time.Minute * 1} TimeScaleWindows = []*TimeScaleDBWindow{ Window24h, Window6h, Window1h, Window10m, Window1m, } )
Functions ¶
Types ¶
type AggregateInfo ¶
type DataBackend ¶
type DataBackend interface { QueryData(ctx context.Context, qp *backend.QueryParams) (*QueriedData, error) QueryTail(ctx context.Context, stationIDs []int32) (*SensorTailData, error) QueryRecentlyAggregated(ctx context.Context, stationIDs []int32, windows []time.Duration) (*RecentlyAggregated, error) }
type DataRow ¶
type DataRow struct { Time time.Time `json:"time"` StationID int32 `json:"station_id"` ModuleID int64 `json:"module_id"` SensorID int64 `json:"sensor_id"` DataStart time.Time `json:"start"` DataEnd time.Time `json:"end"` BucketSamples int `json:"bucket_samples"` AverageValue float64 `json:"average"` MinimumValue float64 `json:"minimum"` MaximumValue float64 `json:"maximum"` LastValue float64 `json:"last"` }
type LastTimeRow ¶
type QueriedData ¶
type RecentlyAggregated ¶
type RecentlyAggregated struct { Windows map[time.Duration][]*backend.DataRow `json:"windows"` Stations map[int32]*StationLastTime `json:"stations"` }
func NewRecentlyAggregated ¶
func NewRecentlyAggregated() *RecentlyAggregated
type SelectedAggregate ¶
type SensorTailData ¶
type SensorTailData struct { Data []*backend.DataRow `json:"data"` Stations map[int32]*StationTailInfo `json:"stations"` }
type StationLastTime ¶
type StationLastTime struct {
Last *data.NumericWireTime `json:"last"`
}
type StationTailInfo ¶
type TailedStation ¶
type TimeScaleDBBackend ¶
type TimeScaleDBBackend struct {
// contains filtered or unexported fields
}
func NewTimeScaleDBBackend ¶
func NewTimeScaleDBBackend(config *storage.TimeScaleDBConfig, db *sqlxcache.DB, metrics *logging.Metrics, querySpec *data.QueryingSpec) (*TimeScaleDBBackend, error)
func (*TimeScaleDBBackend) QueryData ¶
func (tsdb *TimeScaleDBBackend) QueryData(ctx context.Context, qp *backend.QueryParams) (*QueriedData, error)
func (*TimeScaleDBBackend) QueryRecentlyAggregated ¶
func (tsdb *TimeScaleDBBackend) QueryRecentlyAggregated(ctx context.Context, stationIDs []int32, windows []time.Duration) (*RecentlyAggregated, error)
func (*TimeScaleDBBackend) QueryTail ¶
func (tsdb *TimeScaleDBBackend) QueryTail(ctx context.Context, stationIDs []int32) (*SensorTailData, error)
type TimeScaleDBWindow ¶
func (*TimeScaleDBWindow) BucketSize ¶
func (w *TimeScaleDBWindow) BucketSize() int
func (*TimeScaleDBWindow) CalculateMaximumRows ¶
func (w *TimeScaleDBWindow) CalculateMaximumRows(start, end time.Time) int
Click to show internal directories.
Click to hide internal directories.