fix service names in proto
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"go.unistack.org/micro/v3/errors"
|
||||
)
|
||||
|
||||
var _ HealthServer = &Handler{}
|
||||
var _ HealthServiceServer = &Handler{}
|
||||
|
||||
type Handler struct {
|
||||
opts Options
|
||||
|
||||
@@ -7,7 +7,7 @@ import "api/annotations.proto";
|
||||
import "openapiv3/annotations.proto";
|
||||
import "codec/frame.proto";
|
||||
|
||||
service Health {
|
||||
service HealthService {
|
||||
rpc Live(micro.codec.Frame) returns (micro.codec.Frame) {
|
||||
option (micro.openapiv3.openapiv3_operation) = {
|
||||
operation_id: "Live";
|
||||
|
||||
@@ -13,10 +13,10 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
HealthName = "Health"
|
||||
HealthServiceName = "HealthService"
|
||||
)
|
||||
var (
|
||||
HealthServerEndpoints = map[string]map[string]string{
|
||||
HealthServiceServerEndpoints = map[string]map[string]string{
|
||||
"/live": map[string]string{
|
||||
"Method": http.MethodGet,
|
||||
"Stream": "false",
|
||||
@@ -32,7 +32,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
type HealthServer interface {
|
||||
type HealthServiceServer 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
|
||||
|
||||
@@ -11,30 +11,30 @@ import (
|
||||
server "go.unistack.org/micro/v3/server"
|
||||
)
|
||||
|
||||
type healthServer struct {
|
||||
HealthServer
|
||||
type healthServiceServer struct {
|
||||
HealthServiceServer
|
||||
}
|
||||
|
||||
func (h *healthServer) Live(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error {
|
||||
return h.HealthServer.Live(ctx, req, rsp)
|
||||
func (h *healthServiceServer) Live(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error {
|
||||
return h.HealthServiceServer.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 *healthServiceServer) Ready(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error {
|
||||
return h.HealthServiceServer.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 (h *healthServiceServer) Version(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error {
|
||||
return h.HealthServiceServer.Version(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func RegisterHealthServer(s server.Server, sh HealthServer, opts ...server.HandlerOption) error {
|
||||
type health interface {
|
||||
func RegisterHealthServiceServer(s server.Server, sh HealthServiceServer, opts ...server.HandlerOption) error {
|
||||
type healthService interface {
|
||||
}
|
||||
type Health struct {
|
||||
health
|
||||
type HealthService struct {
|
||||
healthService
|
||||
}
|
||||
h := &healthServer{sh}
|
||||
h := &healthServiceServer{sh}
|
||||
var nopts []server.HandlerOption
|
||||
nopts = append(nopts, v3.HandlerMetadata(HealthServerEndpoints))
|
||||
return s.Handle(s.NewHandler(&Health{h}, append(nopts, opts...)...))
|
||||
nopts = append(nopts, v3.HandlerMetadata(HealthServiceServerEndpoints))
|
||||
return s.Handle(s.NewHandler(&HealthService{h}, append(nopts, opts...)...))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user