Documentation ¶
Index ¶
- Variables
- func Logger(ctx context.Context) *zap.Logger
- type AggregateInfo
- type DataBackend
- type DataRange
- type DataRow
- type InfluxDBBackend
- func (idb *InfluxDBBackend) QueryData(ctx context.Context, qp *backend.QueryParams) (*QueriedData, error)
- func (idb *InfluxDBBackend) QueryRanges(ctx context.Context, qp *backend.QueryParams) (*DataRange, error)
- func (idb *InfluxDBBackend) QueryRecentlyAggregated(ctx context.Context, stationIDs []int32, windows []time.Duration) (map[time.Duration][]*backend.DataRow, error)
- func (idb *InfluxDBBackend) QueryTail(ctx context.Context, stationIDs []int32) (*SensorTailData, error)
- type InfluxDBConfig
- type InfluxDBWindow
- type LastTimeRow
- type PostgresBackend
- func (pgb *PostgresBackend) QueryData(ctx context.Context, qp *backend.QueryParams) (*QueriedData, error)
- func (pgb *PostgresBackend) QueryRecentlyAggregated(ctx context.Context, stationIDs []int32, windows []time.Duration) (*RecentlyAggregated, error)
- func (pgb *PostgresBackend) QueryTail(ctx context.Context, stationIDs []int32) (*SensorTailData, error)
- 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, } )
View Source
var ( Windows = []*InfluxDBWindow{ &InfluxDBWindow{Specifier: "24h", Interval: time.Hour * 24}, &InfluxDBWindow{Specifier: "12h", Interval: time.Hour * 12}, &InfluxDBWindow{Specifier: "6h", Interval: time.Hour * 6}, &InfluxDBWindow{Specifier: "1h", Interval: time.Hour * 1}, &InfluxDBWindow{Specifier: "30m", Interval: time.Minute * 30}, &InfluxDBWindow{Specifier: "10m", Interval: time.Minute * 10}, &InfluxDBWindow{Specifier: "1m", Interval: time.Minute * 1}, } )
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 InfluxDBBackend ¶
type InfluxDBBackend struct {
// contains filtered or unexported fields
}
func NewInfluxDBBackend ¶
func NewInfluxDBBackend(config *InfluxDBConfig) (*InfluxDBBackend, error)
func (*InfluxDBBackend) QueryData ¶
func (idb *InfluxDBBackend) QueryData(ctx context.Context, qp *backend.QueryParams) (*QueriedData, error)
func (*InfluxDBBackend) QueryRanges ¶
func (idb *InfluxDBBackend) QueryRanges(ctx context.Context, qp *backend.QueryParams) (*DataRange, error)
func (*InfluxDBBackend) QueryRecentlyAggregated ¶
func (*InfluxDBBackend) QueryTail ¶
func (idb *InfluxDBBackend) QueryTail(ctx context.Context, stationIDs []int32) (*SensorTailData, error)
type InfluxDBConfig ¶
type InfluxDBWindow ¶
func (*InfluxDBWindow) CalculateMaximumRows ¶
func (w *InfluxDBWindow) CalculateMaximumRows(start, end time.Time) int64
type LastTimeRow ¶
type PostgresBackend ¶
type PostgresBackend struct {
// contains filtered or unexported fields
}
func NewPostgresBackend ¶
func NewPostgresBackend(db *sqlxcache.DB) *PostgresBackend
func (*PostgresBackend) QueryData ¶
func (pgb *PostgresBackend) QueryData(ctx context.Context, qp *backend.QueryParams) (*QueriedData, error)
func (*PostgresBackend) QueryRecentlyAggregated ¶
func (pgb *PostgresBackend) QueryRecentlyAggregated(ctx context.Context, stationIDs []int32, windows []time.Duration) (*RecentlyAggregated, error)
func (*PostgresBackend) QueryTail ¶
func (pgb *PostgresBackend) QueryTail(ctx context.Context, stationIDs []int32) (*SensorTailData, error)
type QueriedData ¶
type 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.