rename rpcx to zrpc

This commit is contained in:
kevin
2020-09-18 11:41:52 +08:00
parent 26e16107ce
commit 0b1ee79d3a
110 changed files with 154 additions and 154 deletions

View File

@@ -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",
},
})

View File

@@ -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:

View File

@@ -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,
})

View File

@@ -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 {

View File

@@ -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()

View File

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

View File

@@ -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()

View File

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

View File

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

View File

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

View File

@@ -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()