rename rpcx to zrpc

master v1.0.15
kevin 4 years ago
parent 26e16107ce
commit 0b1ee79d3a

@ -347,8 +347,8 @@ you can change the listening port in file `etc/add.yaml`.
```go
type Config struct {
rest.RestConf
Add rpcx.RpcClientConf // manual code
Check rpcx.RpcClientConf // manual code
Add zrpc.RpcClientConf // manual code
Check zrpc.RpcClientConf // manual code
}
```
@ -364,8 +364,8 @@ you can change the listening port in file `etc/add.yaml`.
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
Adder: adder.NewAdder(rpcx.MustNewClient(c.Add)), // manual code
Checker: checker.NewChecker(rpcx.MustNewClient(c.Check)), // manual code
Adder: adder.NewAdder(zrpc.MustNewClient(c.Add)), // manual code
Checker: checker.NewChecker(zrpc.MustNewClient(c.Check)), // manual code
}
}
```
@ -477,7 +477,7 @@ Till now, weve done the modification of API Gateway. All the manually added c
```go
type Config struct {
rpcx.RpcServerConf
zrpc.RpcServerConf
DataSource string // manual code
Table string // manual code
Cache cache.CacheConf // manual code

@ -349,8 +349,8 @@
```go
type Config struct {
rest.RestConf
Add rpcx.RpcClientConf // 手动代码
Check rpcx.RpcClientConf // 手动代码
Add zrpc.RpcClientConf // 手动代码
Check zrpc.RpcClientConf // 手动代码
}
```
@ -366,8 +366,8 @@
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
Adder: adder.NewAdder(rpcx.MustNewClient(c.Add)), // 手动代码
Checker: checker.NewChecker(rpcx.MustNewClient(c.Check)), // 手动代码
Adder: adder.NewAdder(zrpc.MustNewClient(c.Add)), // 手动代码
Checker: checker.NewChecker(zrpc.MustNewClient(c.Check)), // 手动代码
}
}
```
@ -477,7 +477,7 @@
```go
type Config struct {
rpcx.RpcServerConf
zrpc.RpcServerConf
DataSource string // 手动代码
Table string // 手动代码
Cache cache.CacheConf // 手动代码

@ -221,11 +221,11 @@ OPTIONS:
*rrBalanced does not implement Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)
#github.com/tal-tech/go-zero/rpcx/internal/balancer/p2c
../../../go/pkg/mod/github.com/tal-tech/go-zero@v1.0.12/rpcx/internal/balancer/p2c/p2c.go:41:32: not enough arguments in call to base.NewBalancerBuilder
#github.com/tal-tech/go-zero/zrpc/internal/balancer/p2c
../../../go/pkg/mod/github.com/tal-tech/go-zero@v1.0.12/zrpc/internal/balancer/p2c/p2c.go:41:32: not enough arguments in call to base.NewBalancerBuilder
have (string, *p2cPickerBuilder)
want (string, base.PickerBuilder, base.Config)
../../../go/pkg/mod/github.com/tal-tech/go-zero@v1.0.12/rpcx/internal/balancer/p2c/p2c.go:58:9: cannot use &p2cPicker literal (type *p2cPicker) as type balancer.Picker in return argument:
../../../go/pkg/mod/github.com/tal-tech/go-zero@v1.0.12/zrpc/internal/balancer/p2c/p2c.go:58:9: cannot use &p2cPicker literal (type *p2cPicker) as type balancer.Picker in return argument:
*p2cPicker does not implement balancer.Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)

@ -284,7 +284,7 @@ And now, lets walk through the complete flow of quickly create a microservice
```go
type Config struct {
rest.RestConf
Transform rpcx.RpcClientConf // manual code
Transform zrpc.RpcClientConf // manual code
}
```
@ -299,7 +299,7 @@ And now, lets walk through the complete flow of quickly create a microservice
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
Transformer: transformer.NewTransformer(rpcx.MustNewClient(c.Transform)), // manual code
Transformer: transformer.NewTransformer(zrpc.MustNewClient(c.Transform)), // manual code
}
}
```
@ -409,7 +409,7 @@ Till now, weve done the modification of API Gateway. All the manually added c
```go
type Config struct {
rpcx.RpcServerConf
zrpc.RpcServerConf
DataSource string // manual code
Table string // manual code
Cache cache.CacheConf // manual code

@ -280,7 +280,7 @@
```go
type Config struct {
rest.RestConf
Transform rpcx.RpcClientConf // 手动代码
Transform zrpc.RpcClientConf // 手动代码
}
```
@ -295,7 +295,7 @@
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
Transformer: transformer.NewTransformer(rpcx.MustNewClient(c.Transform)), // 手动代码
Transformer: transformer.NewTransformer(zrpc.MustNewClient(c.Transform)), // 手动代码
}
}
```
@ -405,7 +405,7 @@
```go
type Config struct {
rpcx.RpcServerConf
zrpc.RpcServerConf
DataSource string // 手动代码
Table string // 手动代码
Cache cache.CacheConf // 手动代码

@ -2,11 +2,11 @@ package config
import (
"github.com/tal-tech/go-zero/rest"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
type Config struct {
rest.RestConf
Add rpcx.RpcClientConf
Check rpcx.RpcClientConf
}
Add zrpc.RpcClientConf
Check zrpc.RpcClientConf
}

@ -5,7 +5,7 @@ import (
"bookstore/rpc/add/adder"
"bookstore/rpc/check/checker"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
type ServiceContext struct {
@ -17,7 +17,7 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
Adder: adder.NewAdder(rpcx.MustNewClient(c.Add)),
Checker: checker.NewChecker(rpcx.MustNewClient(c.Check)),
Adder: adder.NewAdder(zrpc.MustNewClient(c.Add)),
Checker: checker.NewChecker(zrpc.MustNewClient(c.Check)),
}
}
}

@ -14,7 +14,7 @@ import (
"github.com/tal-tech/go-zero/core/conf"
"github.com/tal-tech/go-zero/core/logx"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
"google.golang.org/grpc"
)
@ -28,7 +28,7 @@ func main() {
ctx := svc.NewServiceContext(c)
adderSrv := server.NewAdderServer(ctx)
s, err := rpcx.NewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
s, err := zrpc.NewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
add.RegisterAdderServer(grpcServer, adderSrv)
})
logx.Must(err)

@ -10,7 +10,7 @@ import (
"context"
"github.com/tal-tech/go-zero/core/jsonx"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
type (
@ -19,11 +19,11 @@ type (
}
defaultAdder struct {
cli rpcx.Client
cli zrpc.Client
}
)
func NewAdder(cli rpcx.Client) Adder {
func NewAdder(cli zrpc.Client) Adder {
return &defaultAdder{
cli: cli,
}

@ -2,12 +2,12 @@ package config
import (
"github.com/tal-tech/go-zero/core/stores/cache"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
type Config struct {
rpcx.RpcServerConf
zrpc.RpcServerConf
DataSource string
Table string
Cache cache.CacheConf
}
}

@ -14,7 +14,7 @@ import (
"github.com/tal-tech/go-zero/core/conf"
"github.com/tal-tech/go-zero/core/logx"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
"google.golang.org/grpc"
)
@ -28,7 +28,7 @@ func main() {
ctx := svc.NewServiceContext(c)
checkerSrv := server.NewCheckerServer(ctx)
s, err := rpcx.NewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
s, err := zrpc.NewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
check.RegisterCheckerServer(grpcServer, checkerSrv)
})
logx.Must(err)

@ -10,7 +10,7 @@ import (
"context"
"github.com/tal-tech/go-zero/core/jsonx"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
type (
@ -19,11 +19,11 @@ type (
}
defaultChecker struct {
cli rpcx.Client
cli zrpc.Client
}
)
func NewChecker(cli rpcx.Client) Checker {
func NewChecker(cli zrpc.Client) Checker {
return &defaultChecker{
cli: cli,
}

@ -2,12 +2,12 @@ package config
import (
"github.com/tal-tech/go-zero/core/stores/cache"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
type Config struct {
rpcx.RpcServerConf
zrpc.RpcServerConf
DataSource string
Table string
Cache cache.CacheConf
}
}

@ -2,10 +2,10 @@ package config
import (
"github.com/tal-tech/go-zero/rest"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
type Config struct {
rest.RestConf
Rpc rpcx.RpcClientConf
Rpc zrpc.RpcClientConf
}

@ -8,7 +8,7 @@ import (
"github.com/tal-tech/go-zero/example/graceful/dns/api/handler"
"github.com/tal-tech/go-zero/example/graceful/dns/api/svc"
"github.com/tal-tech/go-zero/rest"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
var configFile = flag.String("f", "etc/graceful-api.json", "the config file")
@ -19,7 +19,7 @@ func main() {
var c config.Config
conf.MustLoad(*configFile, &c)
client := rpcx.MustNewClient(c.Rpc)
client := zrpc.MustNewClient(c.Rpc)
ctx := &svc.ServiceContext{
Client: client,
}

@ -1,7 +1,7 @@
package svc
import "github.com/tal-tech/go-zero/rpcx"
import "github.com/tal-tech/go-zero/zrpc"
type ServiceContext struct {
Client rpcx.Client
Client zrpc.Client
}

@ -9,7 +9,7 @@ import (
"github.com/tal-tech/go-zero/core/conf"
"github.com/tal-tech/go-zero/example/graceful/dns/rpc/graceful"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
"google.golang.org/grpc"
)
@ -39,10 +39,10 @@ func (gs *GracefulServer) Grace(ctx context.Context, req *graceful.Request) (*gr
func main() {
flag.Parse()
var c rpcx.RpcServerConf
var c zrpc.RpcServerConf
conf.MustLoad(*configFile, &c)
server := rpcx.MustNewServer(c, func(grpcServer *grpc.Server) {
server := zrpc.MustNewServer(c, func(grpcServer *grpc.Server) {
graceful.RegisterGraceServiceServer(grpcServer, NewGracefulServer())
})
defer server.Stop()

@ -2,10 +2,10 @@ package config
import (
"github.com/tal-tech/go-zero/rest"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
type Config struct {
rest.RestConf
Rpc rpcx.RpcClientConf
Rpc zrpc.RpcClientConf
}

@ -6,7 +6,7 @@
"Rpc": {
"Etcd": {
"Hosts": ["etcd.discov:2379"],
"Key": "rpcx"
"Key": "zrpc"
}
}
}
}

@ -8,7 +8,7 @@ import (
"github.com/tal-tech/go-zero/example/graceful/etcd/api/handler"
"github.com/tal-tech/go-zero/example/graceful/etcd/api/svc"
"github.com/tal-tech/go-zero/rest"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
var configFile = flag.String("f", "etc/graceful-api.json", "the config file")
@ -19,7 +19,7 @@ func main() {
var c config.Config
conf.MustLoad(*configFile, &c)
client := rpcx.MustNewClient(c.Rpc)
client := zrpc.MustNewClient(c.Rpc)
ctx := &svc.ServiceContext{
Client: client,
}

@ -1,7 +1,7 @@
package svc
import "github.com/tal-tech/go-zero/rpcx"
import "github.com/tal-tech/go-zero/zrpc"
type ServiceContext struct {
Client rpcx.Client
Client zrpc.Client
}

@ -3,6 +3,6 @@
"ListenOn": "0.0.0.0:3456",
"Etcd": {
"Hosts": ["etcd.discov:2379"],
"Key": "rpcx"
"Key": "zrpc"
}
}

@ -9,7 +9,7 @@ import (
"github.com/tal-tech/go-zero/core/conf"
"github.com/tal-tech/go-zero/example/graceful/etcd/rpc/graceful"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
"google.golang.org/grpc"
)
@ -39,10 +39,10 @@ func (gs *GracefulServer) Grace(ctx context.Context, req *graceful.Request) (*gr
func main() {
flag.Parse()
var c rpcx.RpcServerConf
var c zrpc.RpcServerConf
conf.MustLoad(*configFile, &c)
server := rpcx.MustNewServer(c, func(grpcServer *grpc.Server) {
server := zrpc.MustNewServer(c, func(grpcServer *grpc.Server) {
graceful.RegisterGraceServiceServer(grpcServer, NewGracefulServer())
})
defer server.Stop()

@ -8,7 +8,7 @@ import (
"github.com/tal-tech/go-zero/core/discov"
"github.com/tal-tech/go-zero/example/rpc/remote/unary"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
const timeFormat = "15:04:05"
@ -16,10 +16,10 @@ const timeFormat = "15:04:05"
func main() {
flag.Parse()
client := rpcx.MustNewClient(rpcx.RpcClientConf{
client := zrpc.MustNewClient(zrpc.RpcClientConf{
Etcd: discov.EtcdConf{
Hosts: []string{"localhost:2379"},
Key: "rpcx",
Key: "zrpc",
},
})

@ -9,7 +9,7 @@ import (
"github.com/tal-tech/go-zero/core/discov"
"github.com/tal-tech/go-zero/example/rpc/remote/unary"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
var lb = flag.String("t", "direct", "the load balancer type")
@ -17,20 +17,20 @@ var lb = flag.String("t", "direct", "the load balancer type")
func main() {
flag.Parse()
var cli rpcx.Client
var cli zrpc.Client
switch *lb {
case "direct":
cli = rpcx.MustNewClient(rpcx.RpcClientConf{
cli = zrpc.MustNewClient(zrpc.RpcClientConf{
Endpoints: []string{
"localhost:3456",
"localhost:3457",
},
})
case "discov":
cli = rpcx.MustNewClient(rpcx.RpcClientConf{
cli = zrpc.MustNewClient(zrpc.RpcClientConf{
Etcd: discov.EtcdConf{
Hosts: []string{"localhost:2379"},
Key: "rpcx",
Key: "zrpc",
},
})
default:

@ -8,17 +8,17 @@ import (
"github.com/tal-tech/go-zero/core/discov"
"github.com/tal-tech/go-zero/example/rpc/remote/stream"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
const name = "kevin"
var key = flag.String("key", "rpcx", "the key on etcd")
var key = flag.String("key", "zrpc", "the key on etcd")
func main() {
flag.Parse()
client, err := rpcx.NewClientNoAuth(discov.EtcdConf{
client, err := zrpc.NewClientNoAuth(discov.EtcdConf{
Hosts: []string{"localhost:2379"},
Key: *key,
})

@ -8,7 +8,7 @@ import (
"github.com/tal-tech/go-zero/core/conf"
"github.com/tal-tech/go-zero/example/rpc/remote/unary"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
var configFile = flag.String("f", "config.json", "the config file")
@ -16,9 +16,9 @@ var configFile = flag.String("f", "config.json", "the config file")
func main() {
flag.Parse()
var c rpcx.RpcClientConf
var c zrpc.RpcClientConf
conf.MustLoad(*configFile, &c)
client := rpcx.MustNewClient(c)
client := zrpc.MustNewClient(c)
ticker := time.NewTicker(time.Millisecond * 500)
defer ticker.Stop()
for {

@ -7,7 +7,7 @@ import (
"github.com/tal-tech/go-zero/core/logx"
"github.com/tal-tech/go-zero/core/service"
"github.com/tal-tech/go-zero/example/rpc/remote/unary"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
"google.golang.org/grpc"
)
@ -17,7 +17,7 @@ var (
)
type GreetServer struct {
*rpcx.RpcProxy
*zrpc.RpcProxy
}
func (s *GreetServer) Greet(ctx context.Context, req *unary.Request) (*unary.Response, error) {
@ -33,7 +33,7 @@ func (s *GreetServer) Greet(ctx context.Context, req *unary.Request) (*unary.Res
func main() {
flag.Parse()
proxy := rpcx.MustNewServer(rpcx.RpcServerConf{
proxy := zrpc.MustNewServer(zrpc.RpcServerConf{
ServiceConf: service.ServiceConf{
Log: logx.LogConf{
Mode: "console",
@ -42,7 +42,7 @@ func main() {
ListenOn: *listen,
}, func(grpcServer *grpc.Server) {
unary.RegisterGreeterServer(grpcServer, &GreetServer{
RpcProxy: rpcx.NewProxy(*server),
RpcProxy: zrpc.NewProxy(*server),
})
})
proxy.Start()

@ -6,7 +6,7 @@
"Hosts": [
"localhost:2379"
],
"Key": "rpcx"
"Key": "zrpc"
},
"Redis": {
"Host": "localhost:6379",

@ -6,7 +6,7 @@ import (
"github.com/tal-tech/go-zero/core/conf"
"github.com/tal-tech/go-zero/example/rpc/remote/stream"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
"google.golang.org/grpc"
)
@ -39,10 +39,10 @@ func (gs StreamGreetServer) Greet(s stream.StreamGreeter_GreetServer) error {
}
func main() {
var c rpcx.RpcServerConf
var c zrpc.RpcServerConf
conf.MustLoad("etc/config.json", &c)
server := rpcx.MustNewServer(c, func(grpcServer *grpc.Server) {
server := zrpc.MustNewServer(c, func(grpcServer *grpc.Server) {
stream.RegisterStreamGreeterServer(grpcServer, StreamGreetServer(0))
})
server.Start()

@ -8,6 +8,6 @@
"Hosts": [
"localhost:2379"
],
"Key": "rpcx"
"Key": "zrpc"
}
}

@ -8,6 +8,6 @@
"Hosts": [
"localhost:2379"
],
"Key": "rpcx"
"Key": "zrpc"
}
}

@ -6,7 +6,7 @@
"Hosts": [
"etcd.discov:2379"
],
"Key": "rpcx"
"Key": "zrpc"
},
"Timeout": 500
}

@ -10,7 +10,7 @@ import (
"github.com/tal-tech/go-zero/core/conf"
"github.com/tal-tech/go-zero/example/rpc/remote/unary"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
"google.golang.org/grpc"
)
@ -44,10 +44,10 @@ func (gs *GreetServer) Greet(ctx context.Context, req *unary.Request) (*unary.Re
func main() {
flag.Parse()
var c rpcx.RpcServerConf
var c zrpc.RpcServerConf
conf.MustLoad(*configFile, &c)
server := rpcx.MustNewServer(c, func(grpcServer *grpc.Server) {
server := zrpc.MustNewServer(c, func(grpcServer *grpc.Server) {
unary.RegisterGreeterServer(grpcServer, NewGreetServer())
})
server.Start()

@ -2,10 +2,10 @@ package config
import (
"github.com/tal-tech/go-zero/rest"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
type Config struct {
rest.RestConf
Transform rpcx.RpcClientConf
Transform zrpc.RpcClientConf
}

@ -4,7 +4,7 @@ import (
"shorturl/api/internal/config"
"shorturl/rpc/transform/transformer"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
type ServiceContext struct {
@ -15,6 +15,6 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
Transformer: transformer.NewTransformer(rpcx.MustNewClient(c.Transform)),
Transformer: transformer.NewTransformer(zrpc.MustNewClient(c.Transform)),
}
}

@ -2,11 +2,11 @@ package config
import (
"github.com/tal-tech/go-zero/core/stores/cache"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
type Config struct {
rpcx.RpcServerConf
zrpc.RpcServerConf
DataSource string
Table string
Cache cache.CacheConf

@ -14,7 +14,7 @@ import (
transform "shorturl/rpc/transform/pb"
"github.com/tal-tech/go-zero/core/conf"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
"google.golang.org/grpc"
)
@ -28,7 +28,7 @@ func main() {
ctx := svc.NewServiceContext(c)
transformerSrv := server.NewTransformerServer(ctx)
s, err := rpcx.NewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
s, err := zrpc.NewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
transform.RegisterTransformerServer(grpcServer, transformerSrv)
})
if err != nil {

@ -11,7 +11,7 @@ import (
transform "shorturl/rpc/transform/pb"
"github.com/tal-tech/go-zero/core/jsonx"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
type (
@ -21,11 +21,11 @@ type (
}
defaultTransformer struct {
cli rpcx.Client
cli zrpc.Client
}
)
func NewTransformer(cli rpcx.Client) Transformer {
func NewTransformer(cli zrpc.Client) Transformer {
return &defaultTransformer{
cli: cli,
}

@ -10,17 +10,17 @@ import (
"github.com/tal-tech/go-zero/example/tracing/remote/portal"
"github.com/tal-tech/go-zero/rest"
"github.com/tal-tech/go-zero/rest/httpx"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
var (
configFile = flag.String("f", "config.json", "the config file")
client rpcx.Client
client zrpc.Client
)
type Config struct {
rest.RestConf
Portal rpcx.RpcClientConf
Portal zrpc.RpcClientConf
}
func handle(w http.ResponseWriter, r *http.Request) {
@ -41,7 +41,7 @@ func main() {
var c Config
conf.MustLoad(*configFile, &c)
client = rpcx.MustNewClient(c.Portal)
client = zrpc.MustNewClient(c.Portal)
engine := rest.MustNewServer(rest.RestConf{
ServiceConf: service.ServiceConf{
Log: logx.LogConf{

@ -7,7 +7,7 @@ import (
"github.com/tal-tech/go-zero/core/conf"
"github.com/tal-tech/go-zero/example/tracing/remote/portal"
"github.com/tal-tech/go-zero/example/tracing/remote/user"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
"google.golang.org/grpc"
)
@ -15,16 +15,16 @@ var configFile = flag.String("f", "etc/config.json", "the config file")
type (
Config struct {
rpcx.RpcServerConf
UserRpc rpcx.RpcClientConf
zrpc.RpcServerConf
UserRpc zrpc.RpcClientConf
}
PortalServer struct {
userRpc rpcx.Client
userRpc zrpc.Client
}
)
func NewPortalServer(client rpcx.Client) *PortalServer {
func NewPortalServer(client zrpc.Client) *PortalServer {
return &PortalServer{
userRpc: client,
}
@ -53,8 +53,8 @@ func main() {
var c Config
conf.MustLoad(*configFile, &c)
client := rpcx.MustNewClient(c.UserRpc)
server := rpcx.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
client := zrpc.MustNewClient(c.UserRpc)
server := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
portal.RegisterPortalServer(grpcServer, NewPortalServer(client))
})
server.Start()

@ -10,7 +10,7 @@ import (
"github.com/tal-tech/go-zero/core/conf"
"github.com/tal-tech/go-zero/example/tracing/remote/user"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
"google.golang.org/grpc"
)
@ -44,10 +44,10 @@ func (gs *UserServer) GetGrade(ctx context.Context, req *user.UserRequest) (*use
func main() {
flag.Parse()
var c rpcx.RpcServerConf
var c zrpc.RpcServerConf
conf.MustLoad(*configFile, &c)
server := rpcx.MustNewServer(c, func(grpcServer *grpc.Server) {
server := zrpc.MustNewServer(c, func(grpcServer *grpc.Server) {
user.RegisterUserServer(grpcServer, NewUserServer())
})
server.Start()

@ -20,7 +20,7 @@ type (
// why not name it as Conf, because we need to consider usage like:
// type Config struct {
// rpcx.RpcConf
// zrpc.RpcConf
// rest.RestConf
// }
// if with the name Conf, there will be two Conf inside Config.

@ -220,11 +220,11 @@ OPTIONS:
*rrBalanced does not implement Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)
#github.com/tal-tech/go-zero/rpcx/internal/balancer/p2c
../../../go/pkg/mod/github.com/tal-tech/go-zero@v1.0.12/rpcx/internal/balancer/p2c/p2c.go:41:32: not enough arguments in call to base.NewBalancerBuilder
#github.com/tal-tech/go-zero/zrpc/internal/balancer/p2c
../../../go/pkg/mod/github.com/tal-tech/go-zero@v1.0.12/zrpc/internal/balancer/p2c/p2c.go:41:32: not enough arguments in call to base.NewBalancerBuilder
have (string, *p2cPickerBuilder)
want (string, base.PickerBuilder, base.Config)
../../../go/pkg/mod/github.com/tal-tech/go-zero@v1.0.12/rpcx/internal/balancer/p2c/p2c.go:58:9: cannot use &p2cPicker literal (type *p2cPicker) as type balancer.Picker in return argument:
../../../go/pkg/mod/github.com/tal-tech/go-zero@v1.0.12/zrpc/internal/balancer/p2c/p2c.go:58:9: cannot use &p2cPicker literal (type *p2cPicker) as type balancer.Picker in return argument:
*p2cPicker does not implement balancer.Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)

@ -25,7 +25,7 @@ import (
{{.package}}
"github.com/tal-tech/go-zero/core/jsonx"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
)
type (
@ -34,11 +34,11 @@ type (
}
default{{.serviceName}} struct {
cli rpcx.Client
cli zrpc.Client
}
)
func New{{.serviceName}}(cli rpcx.Client) {{.serviceName}} {
func New{{.serviceName}}(cli zrpc.Client) {{.serviceName}} {
return &default{{.serviceName}}{
cli: cli,
}

@ -10,10 +10,10 @@ import (
const configTemplate = `package config
import "github.com/tal-tech/go-zero/rpcx"
import "github.com/tal-tech/go-zero/zrpc"
type Config struct {
rpcx.RpcServerConf
zrpc.RpcServerConf
}
`

@ -21,7 +21,7 @@ import (
"github.com/tal-tech/go-zero/core/conf"
"github.com/tal-tech/go-zero/core/logx"
"github.com/tal-tech/go-zero/rpcx"
"github.com/tal-tech/go-zero/zrpc"
"google.golang.org/grpc"
)
@ -35,7 +35,7 @@ func main() {
ctx := svc.NewServiceContext(c)
{{.srv}}
s, err := rpcx.NewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
s, err := zrpc.NewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
{{.registers}}
})
logx.Must(err)

@ -1,12 +1,12 @@
package rpcx
package zrpc
import (
"log"
"time"
"github.com/tal-tech/go-zero/core/discov"
"github.com/tal-tech/go-zero/rpcx/internal"
"github.com/tal-tech/go-zero/rpcx/internal/auth"
"github.com/tal-tech/go-zero/zrpc/internal"
"github.com/tal-tech/go-zero/zrpc/internal/auth"
"google.golang.org/grpc"
)

@ -1,4 +1,4 @@
package rpcx
package zrpc
import (
"context"
@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/tal-tech/go-zero/core/logx"
"github.com/tal-tech/go-zero/rpcx/internal/mock"
"github.com/tal-tech/go-zero/zrpc/internal/mock"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

@ -1,4 +1,4 @@
package rpcx
package zrpc
import (
"github.com/tal-tech/go-zero/core/discov"

@ -1,4 +1,4 @@
package rpcx
package zrpc
import (
"testing"

@ -13,7 +13,7 @@ import (
"github.com/tal-tech/go-zero/core/logx"
"github.com/tal-tech/go-zero/core/syncx"
"github.com/tal-tech/go-zero/core/timex"
"github.com/tal-tech/go-zero/rpcx/internal/codes"
"github.com/tal-tech/go-zero/zrpc/internal/codes"
"google.golang.org/grpc/balancer"
"google.golang.org/grpc/balancer/base"
"google.golang.org/grpc/resolver"

@ -5,9 +5,9 @@ import (
"fmt"
"time"
"github.com/tal-tech/go-zero/rpcx/internal/balancer/p2c"
"github.com/tal-tech/go-zero/rpcx/internal/clientinterceptors"
"github.com/tal-tech/go-zero/rpcx/internal/resolver"
"github.com/tal-tech/go-zero/zrpc/internal/balancer/p2c"
"github.com/tal-tech/go-zero/zrpc/internal/clientinterceptors"
"github.com/tal-tech/go-zero/zrpc/internal/resolver"
"google.golang.org/grpc"
)

@ -5,7 +5,7 @@ import (
"path"
"github.com/tal-tech/go-zero/core/breaker"
"github.com/tal-tech/go-zero/rpcx/internal/codes"
"github.com/tal-tech/go-zero/zrpc/internal/codes"
"google.golang.org/grpc"
)

@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/tal-tech/go-zero/core/breaker"
"github.com/tal-tech/go-zero/core/stat"
rcodes "github.com/tal-tech/go-zero/rpcx/internal/codes"
rcodes "github.com/tal-tech/go-zero/zrpc/internal/codes"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

@ -5,7 +5,7 @@ import (
"github.com/tal-tech/go-zero/core/proc"
"github.com/tal-tech/go-zero/core/stat"
"github.com/tal-tech/go-zero/rpcx/internal/serverinterceptors"
"github.com/tal-tech/go-zero/zrpc/internal/serverinterceptors"
"google.golang.org/grpc"
)

@ -3,7 +3,7 @@ package serverinterceptors
import (
"context"
"github.com/tal-tech/go-zero/rpcx/internal/auth"
"github.com/tal-tech/go-zero/zrpc/internal/auth"
"google.golang.org/grpc"
)

@ -7,7 +7,7 @@ import (
"github.com/alicebob/miniredis"
"github.com/stretchr/testify/assert"
"github.com/tal-tech/go-zero/core/stores/redis"
"github.com/tal-tech/go-zero/rpcx/internal/auth"
"github.com/tal-tech/go-zero/zrpc/internal/auth"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
)

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save