-
Notifications
You must be signed in to change notification settings - Fork 57
/
serve.go
37 lines (30 loc) · 979 Bytes
/
serve.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package datasource
import (
"github.com/grafana/grafana-plugin-sdk-go/backend"
)
// ServeOpts options for serving a data source plugin.
type ServeOpts struct {
// CheckHealthHandler handler for health checks.
// Optional to implement.
backend.CheckHealthHandler
// CallResourceHandler handler for resource calls.
// Optional to implement.
backend.CallResourceHandler
// QueryDataHandler handler for data queries.
// Required to implement.
backend.QueryDataHandler
// StreamHandler for streaming queries.
backend.StreamHandler
// GRPCSettings settings for gPRC.
GRPCSettings backend.GRPCSettings
}
// Serve starts serving the data source over gPRC.
func Serve(opts ServeOpts) error {
return backend.Serve(backend.ServeOpts{
CheckHealthHandler: opts.CheckHealthHandler,
CallResourceHandler: opts.CallResourceHandler,
QueryDataHandler: opts.QueryDataHandler,
StreamHandler: opts.StreamHandler,
GRPCSettings: opts.GRPCSettings,
})
}