2020-08-14 19:37:30 +00:00
|
|
|
package http
|
|
|
|
|
|
|
|
import (
|
2020-08-18 21:04:35 +00:00
|
|
|
"github.com/influxdata/influxdb/v2/http/legacy"
|
2020-08-14 19:37:30 +00:00
|
|
|
)
|
|
|
|
|
2020-08-18 21:04:35 +00:00
|
|
|
// newLegacyBackend constructs a legacy backend from an api backend.
|
|
|
|
func newLegacyBackend(b *APIBackend) *legacy.Backend {
|
|
|
|
return &legacy.Backend{
|
2020-08-14 19:37:30 +00:00
|
|
|
HTTPErrorHandler: b.HTTPErrorHandler,
|
|
|
|
Logger: b.Logger,
|
|
|
|
// TODO(sgc): /write support
|
|
|
|
//MaxBatchSizeBytes: b.APIBackend.MaxBatchSizeBytes,
|
|
|
|
AuthorizationService: b.AuthorizationService,
|
|
|
|
OrganizationService: b.OrganizationService,
|
|
|
|
BucketService: b.BucketService,
|
|
|
|
PointsWriter: b.PointsWriter,
|
2021-08-30 22:27:11 +00:00
|
|
|
DBRPMappingService: b.DBRPService,
|
2020-08-14 19:37:30 +00:00
|
|
|
ProxyQueryService: b.InfluxQLService,
|
|
|
|
InfluxqldQueryService: b.InfluxqldService,
|
|
|
|
WriteEventRecorder: b.WriteEventRecorder,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-18 21:04:35 +00:00
|
|
|
// newLegacyHandler constructs a legacy handler from a backend.
|
|
|
|
func newLegacyHandler(b *legacy.Backend, config legacy.HandlerConfig) *legacy.Handler {
|
|
|
|
h := &legacy.Handler{
|
2020-08-14 19:37:30 +00:00
|
|
|
HTTPErrorHandler: b.HTTPErrorHandler,
|
|
|
|
}
|
|
|
|
|
2020-08-18 21:04:35 +00:00
|
|
|
pointsWriterBackend := legacy.NewPointsWriterBackend(b)
|
|
|
|
h.PointsWriterHandler = legacy.NewWriterHandler(pointsWriterBackend, legacy.WithMaxBatchSizeBytes(b.MaxBatchSizeBytes))
|
2020-08-14 19:37:30 +00:00
|
|
|
|
2020-08-18 21:04:35 +00:00
|
|
|
influxqlBackend := legacy.NewInfluxQLBackend(b)
|
|
|
|
h.InfluxQLHandler = legacy.NewInfluxQLHandler(influxqlBackend, config)
|
2020-08-14 19:37:30 +00:00
|
|
|
|
2021-11-12 20:32:12 +00:00
|
|
|
h.PingHandler = legacy.NewPingHandler()
|
2020-08-14 19:37:30 +00:00
|
|
|
return h
|
|
|
|
}
|