Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/pkg/agentproto/func.go
4094 views
1
package agentproto
2
3
import (
4
"context"
5
6
empty "github.com/golang/protobuf/ptypes/empty"
7
)
8
9
// FuncScrapingServiceServer is an implementation of ScrapingServiceServer that
10
// uses function fields to implement the interface. Useful for tests.
11
type FuncScrapingServiceServer struct {
12
ReshardFunc func(context.Context, *ReshardRequest) (*empty.Empty, error)
13
}
14
15
// Reshard implements ScrapingServiceServer.
16
func (f *FuncScrapingServiceServer) Reshard(ctx context.Context, req *ReshardRequest) (*empty.Empty, error) {
17
if f.ReshardFunc != nil {
18
return f.ReshardFunc(ctx, req)
19
}
20
panic("ReshardFunc is nil")
21
}
22
23