prepare_v4 (#199)
All checks were successful
test / test (push) Successful in 1m56s

move to v4 micro

Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org>
Reviewed-on: #199
Co-authored-by: Evstigneev Denis <danteevstigneev@yandex.ru>
Co-committed-by: Evstigneev Denis <danteevstigneev@yandex.ru>
This commit is contained in:
2025-03-02 12:33:55 +03:00
parent 707476bbd4
commit 76bf0520c0
22 changed files with 225 additions and 537 deletions

View File

@@ -8,10 +8,10 @@ import (
"strings"
"sync"
codecpb "go.unistack.org/micro-proto/v3/codec"
"go.unistack.org/micro/v3/logger"
"go.unistack.org/micro/v3/metadata"
"go.unistack.org/micro/v3/meter"
codecpb "go.unistack.org/micro-proto/v4/codec"
"go.unistack.org/micro/v4/logger"
"go.unistack.org/micro/v4/metadata"
"go.unistack.org/micro/v4/meter"
)
const (
@@ -125,8 +125,11 @@ func gzipAccepted(md metadata.Metadata) bool {
if !ok {
return false
}
if strings.Contains(a, "gzip") {
return true
for i := range a {
if strings.Contains(a[i], "gzip") {
return true
}
}
return false
}

View File

@@ -1,7 +1,7 @@
syntax = "proto3";
package micro.server.http.v3.handler.meter;
option go_package = "go.unistack.org/micro-server-http/v3/handler/meter;meter_handler";
option go_package = "go.unistack.org/micro-server-http/v4/handler/meter;meter_handler";
import "api/annotations.proto";
import "openapiv3/annotations.proto";

View File

@@ -1,15 +1,15 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro v3.10.4
// - protoc v5.28.3
// - protoc-gen-go-micro v4.1.0
// - protoc v5.29.3
// source: meter/meter.proto
package meter_handler
import (
context "context"
codec "go.unistack.org/micro-proto/v3/codec"
client "go.unistack.org/micro/v3/client"
codec "go.unistack.org/micro-proto/v4/codec"
client "go.unistack.org/micro/v4/client"
)
var (

View File

@@ -1,21 +1,21 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.4
// protoc-gen-go-micro version: v4.1.0
// source: meter/meter.proto
package meter_handler
import (
context "context"
v31 "go.unistack.org/micro-client-http/v3"
codec "go.unistack.org/micro-proto/v3/codec"
v3 "go.unistack.org/micro-server-http/v3"
client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server"
v41 "go.unistack.org/micro-client-http/v4"
codec "go.unistack.org/micro-proto/v4/codec"
v4 "go.unistack.org/micro-server-http/v4"
client "go.unistack.org/micro/v4/client"
server "go.unistack.org/micro/v4/server"
http "net/http"
)
var (
MeterServiceServerEndpoints = []v3.EndpointMetadata{
MeterServiceServerEndpoints = []v4.EndpointMetadata{
{
Name: "MeterService.Metrics",
Path: "/metrics",
@@ -39,11 +39,11 @@ func (c *meterServiceClient) Metrics(ctx context.Context, req *codec.Frame, opts
errmap := make(map[string]interface{}, 1)
errmap["default"] = &codec.Frame{}
opts = append(opts,
v31.ErrorMap(errmap),
v41.ErrorMap(errmap),
)
opts = append(opts,
v31.Method(http.MethodGet),
v31.Path("/metrics"),
v41.Method(http.MethodGet),
v41.Path("/metrics"),
)
rsp := &codec.Frame{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "MeterService.Metrics", req), rsp, opts...)
@@ -69,7 +69,6 @@ func RegisterMeterServiceServer(s server.Server, sh MeterServiceServer, opts ...
meterService
}
h := &meterServiceServer{sh}
var nopts []server.HandlerOption
nopts = append(nopts, v3.HandlerEndpoints(MeterServiceServerEndpoints))
return s.Handle(s.NewHandler(&MeterService{h}, append(nopts, opts...)...))
opts = append(opts, v4.HandlerEndpoints(MeterServiceServerEndpoints))
return s.Handle(s.NewHandler(&MeterService{h}, opts...))
}