2021-03-28 19:17:08 +03:00
|
|
|
// Code generated by protoc-gen-micro
|
|
|
|
// source: health.proto
|
2021-03-28 19:28:01 +03:00
|
|
|
package health
|
2021-03-28 19:17:08 +03:00
|
|
|
|
|
|
|
import (
|
|
|
|
context "context"
|
|
|
|
api "github.com/unistack-org/micro/v3/api"
|
|
|
|
codec "github.com/unistack-org/micro/v3/codec"
|
|
|
|
server "github.com/unistack-org/micro/v3/server"
|
|
|
|
)
|
|
|
|
|
|
|
|
type healthServer struct {
|
|
|
|
HealthServer
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *healthServer) Live(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error {
|
|
|
|
return h.HealthServer.Live(ctx, req, rsp)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *healthServer) Ready(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error {
|
|
|
|
return h.HealthServer.Ready(ctx, req, rsp)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *healthServer) Version(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error {
|
|
|
|
return h.HealthServer.Version(ctx, req, rsp)
|
|
|
|
}
|
|
|
|
|
|
|
|
func RegisterHealthServer(s server.Server, sh HealthServer, opts ...server.HandlerOption) error {
|
|
|
|
type health interface {
|
|
|
|
Live(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error
|
|
|
|
Ready(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error
|
|
|
|
Version(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error
|
|
|
|
}
|
|
|
|
type Health struct {
|
|
|
|
health
|
|
|
|
}
|
|
|
|
h := &healthServer{sh}
|
|
|
|
var nopts []server.HandlerOption
|
|
|
|
for _, endpoint := range NewHealthEndpoints() {
|
|
|
|
nopts = append(nopts, api.WithEndpoint(endpoint))
|
|
|
|
}
|
|
|
|
return s.Handle(s.NewHandler(&Health{h}, append(nopts, opts...)...))
|
|
|
|
}
|