api: remove and regen

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2023-02-21 02:10:24 +03:00
parent ce9f896287
commit 56efccc4cf
6 changed files with 30 additions and 475 deletions

View File

@@ -1,32 +1,29 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.5.3
// versions:
// - protoc-gen-go-micro v3.5.3
// - protoc v3.21.12
// source: handler.proto
package handler
import (
context "context"
api "go.unistack.org/micro/v3/api"
codec "go.unistack.org/micro/v3/codec"
http "net/http"
)
var (
MeterName = "Meter"
MeterEndpoints = []api.Endpoint{
{
Name: "Meter.Metrics",
Path: []string{"/metrics"},
Method: []string{"GET"},
Handler: "rpc",
)
var (
MeterServerEndpoints = map[string]map[string]string{
"/metrics": map[string]string{
"Method": http.MethodGet,
"Stream": "false",
},
}
)
func NewMeterEndpoints() []api.Endpoint {
return MeterEndpoints
}
type MeterServer interface {
Metrics(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error
}

View File

@@ -6,7 +6,7 @@ package handler
import (
context "context"
api "go.unistack.org/micro/v3/api"
v3 "go.unistack.org/micro-server-http/v3"
codec "go.unistack.org/micro/v3/codec"
server "go.unistack.org/micro/v3/server"
)
@@ -21,15 +21,12 @@ func (h *meterServer) Metrics(ctx context.Context, req *codec.Frame, rsp *codec.
func RegisterMeterServer(s server.Server, sh MeterServer, opts ...server.HandlerOption) error {
type meter interface {
Metrics(ctx context.Context, req *codec.Frame, rsp *codec.Frame) error
}
type Meter struct {
meter
}
h := &meterServer{sh}
var nopts []server.HandlerOption
for _, endpoint := range MeterEndpoints {
nopts = append(nopts, api.WithEndpoint(&endpoint))
}
nopts = append(nopts, v3.HandlerMetadata(MeterServerEndpoints))
return s.Handle(s.NewHandler(&Meter{h}, append(nopts, opts...)...))
}