This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/develop by this push:
new bc98c2dfb move internal into dubbo-go-samples repo (#2794)
bc98c2dfb is described below
commit bc98c2dfb591c43b8203e42e1452ae46192b5fb1
Author: marsevilspirit <[email protected]>
AuthorDate: Sat Mar 22 17:34:53 2025 +0800
move internal into dubbo-go-samples repo (#2794)
* move internal into dubbo-go-samples repo
* remove triple test to samples
---
protocol/triple/internal/client/cmd_client/main.go | 57 --
.../client/cmd_client_with_registry/main.go | 46 --
.../triple/internal/client/cmd_instance/main.go | 51 --
.../client/cmd_instance_with_registry/main.go | 57 --
.../internal/client/cmd_with_yml/cmd/main.go | 38 --
.../internal/client/cmd_with_yml/conf/dubbogo.yml | 7 -
protocol/triple/internal/client/common/client.go | 119 ----
.../triple/internal/client/health_client/main.go | 75 ---
.../internal/client/reflection_client/main.go | 125 ----
.../internal/dubbo3_server/api/greet_service.go | 142 -----
.../triple/internal/dubbo3_server/cmd/dubbogo.yml | 13 -
protocol/triple/internal/dubbo3_server/cmd/main.go | 32 --
.../internal/proto/dubbo3_gen/greet_triple.pb.go | 399 -------------
protocol/triple/internal/proto/greet.pb.go | 637 ---------------------
protocol/triple/internal/proto/greet.proto | 44 --
.../proto/triple_gen/greettriple/greet.triple.go | 396 -------------
.../triple/internal/server/api/greet_service.go | 128 -----
.../triple/internal/server/cmd_instance/main.go | 51 --
.../server/cmd_instance_with_registry/main.go | 56 --
protocol/triple/internal/server/cmd_server/main.go | 46 --
.../server/cmd_server_with_registry/main.go | 49 --
.../internal/server/cmd_with_yml/cmd/main.go | 33 --
.../internal/server/cmd_with_yml/conf/dubbogo.yml | 10 -
protocol/triple/triple_test.go | 496 ----------------
24 files changed, 3107 deletions(-)
diff --git a/protocol/triple/internal/client/cmd_client/main.go
b/protocol/triple/internal/client/cmd_client/main.go
deleted file mode 100644
index b304285e2..000000000
--- a/protocol/triple/internal/client/cmd_client/main.go
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "context"
- "fmt"
- "time"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3/client"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
- "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/client/common"
- greet "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto"
-
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/triple_gen/greettriple"
-)
-
-func main() {
- // for the most brief RPC case
- cli, err := client.NewClient(
- client.WithClientURL("127.0.0.1:20000"),
- )
-
- if err != nil {
- panic(err)
- }
- svc, err := greettriple.NewGreetService(cli)
-
- if err != nil {
- panic(err)
- }
-
- response, err := svc.Greet(context.Background(),
&greet.GreetRequest{Name: "greet"},
client.WithCallRequestTimeout(5*time.Second))
- if err != nil {
- panic(err)
- }
-
- fmt.Printf("result: %s", response.Greeting)
-
- common.TestClient(svc)
-}
diff --git a/protocol/triple/internal/client/cmd_client_with_registry/main.go
b/protocol/triple/internal/client/cmd_client_with_registry/main.go
deleted file mode 100644
index 39902a11d..000000000
--- a/protocol/triple/internal/client/cmd_client_with_registry/main.go
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "dubbo.apache.org/dubbo-go/v3/client"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
- "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/client/common"
-
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/triple_gen/greettriple"
- "dubbo.apache.org/dubbo-go/v3/registry"
-)
-
-func main() {
- // for the most brief RPC case with Registry
-
- cli, err := client.NewClient(
- client.WithClientRegistry(
- registry.WithZookeeper(),
- registry.WithAddress("127.0.0.1:2181"),
- ),
- )
- if err != nil {
- panic(err)
- }
- svc, err := greettriple.NewGreetService(cli)
- if err != nil {
- panic(err)
- }
-
- common.TestClient(svc)
-}
diff --git a/protocol/triple/internal/client/cmd_instance/main.go
b/protocol/triple/internal/client/cmd_instance/main.go
deleted file mode 100644
index cd0eeed3f..000000000
--- a/protocol/triple/internal/client/cmd_instance/main.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "dubbo.apache.org/dubbo-go/v3"
- "dubbo.apache.org/dubbo-go/v3/client"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
- "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/client/common"
-
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/triple_gen/greettriple"
-)
-
-func main() {
- // global conception
- // configure global configurations and common modules
- ins, err := dubbo.NewInstance(
- dubbo.WithName("dubbo_test"),
- )
- if err != nil {
- panic(err)
- }
- // configure the params that only client layer cares
- cli, err := ins.NewClient(
- client.WithClientURL("127.0.0.1:20000"),
- )
- if err != nil {
- panic(err)
- }
-
- svc, err := greettriple.NewGreetService(cli)
- if err != nil {
- panic(err)
- }
-
- common.TestClient(svc)
-}
diff --git a/protocol/triple/internal/client/cmd_instance_with_registry/main.go
b/protocol/triple/internal/client/cmd_instance_with_registry/main.go
deleted file mode 100644
index 7da6d0b96..000000000
--- a/protocol/triple/internal/client/cmd_instance_with_registry/main.go
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "dubbo.apache.org/dubbo-go/v3"
- "dubbo.apache.org/dubbo-go/v3/client"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
- "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/client/common"
-
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/triple_gen/greettriple"
- "dubbo.apache.org/dubbo-go/v3/registry"
-)
-
-func main() {
- // global conception
- // configure global configurations and common modules
- ins, err := dubbo.NewInstance(
- dubbo.WithName("dubbo_test"),
- dubbo.WithRegistry(
- registry.WithID("zk"),
- registry.WithZookeeper(),
- registry.WithAddress("127.0.0.1:2181"),
- ),
- )
- if err != nil {
- panic(err)
- }
- // configure the params that only client layer cares
- cli, err := ins.NewClient(
- client.WithClientRegistryIDs("zk"),
- )
- if err != nil {
- panic(err)
- }
-
- svc, err := greettriple.NewGreetService(cli)
- if err != nil {
- panic(err)
- }
-
- common.TestClient(svc)
-}
diff --git a/protocol/triple/internal/client/cmd_with_yml/cmd/main.go
b/protocol/triple/internal/client/cmd_with_yml/cmd/main.go
deleted file mode 100644
index 55ed88451..000000000
--- a/protocol/triple/internal/client/cmd_with_yml/cmd/main.go
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "dubbo.apache.org/dubbo-go/v3"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
- "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/client/common"
-
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/triple_gen/greettriple"
-)
-
-var svc = &greettriple.GreetServiceImpl{}
-
-func init() {
- greettriple.SetConsumerService(svc)
-}
-
-func main() {
- if err := dubbo.Load(); err != nil {
- panic(err)
- }
- common.TestClient(svc)
-}
diff --git a/protocol/triple/internal/client/cmd_with_yml/conf/dubbogo.yml
b/protocol/triple/internal/client/cmd_with_yml/conf/dubbogo.yml
deleted file mode 100644
index 7b634aa31..000000000
--- a/protocol/triple/internal/client/cmd_with_yml/conf/dubbogo.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-# dubbo client yaml configure file
-dubbo:
- registries:
- demoZK:
- protocol: zookeeper
- timeout: 3s
- address: 127.0.0.1:2181
\ No newline at end of file
diff --git a/protocol/triple/internal/client/common/client.go
b/protocol/triple/internal/client/common/client.go
deleted file mode 100644
index 0da91cb74..000000000
--- a/protocol/triple/internal/client/common/client.go
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package common
-
-import (
- "context"
-)
-
-import (
- "github.com/dubbogo/gost/log/logger"
-)
-
-import (
- greet "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto"
-
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/triple_gen/greettriple"
-)
-
-func TestClient(cli greettriple.GreetService) {
- if err := testUnary(cli); err != nil {
- logger.Error(err)
- }
-
- if err := testBidiStream(cli); err != nil {
- logger.Error(err)
- }
-
- if err := testClientStream(cli); err != nil {
- logger.Error(err)
- }
-
- if err := testServerStream(cli); err != nil {
- logger.Error(err)
- }
-}
-
-func testUnary(cli greettriple.GreetService) error {
- logger.Info("start to test TRIPLE unary call")
- resp, err := cli.Greet(context.Background(), &greet.GreetRequest{Name:
"triple"})
- if err != nil {
- return err
- }
- logger.Infof("TRIPLE unary call resp: %s", resp.Greeting)
- return nil
-}
-
-func testBidiStream(cli greettriple.GreetService) error {
- logger.Info("start to test TRIPLE bidi stream")
- stream, err := cli.GreetStream(context.Background())
- if err != nil {
- return err
- }
- if sendErr := stream.Send(&greet.GreetStreamRequest{Name: "triple"});
sendErr != nil {
- return sendErr
- }
- resp, err := stream.Recv()
- if err != nil {
- return err
- }
- logger.Infof("TRIPLE bidi stream resp: %s", resp.Greeting)
- if err := stream.CloseRequest(); err != nil {
- return err
- }
- if err := stream.CloseResponse(); err != nil {
- return err
- }
- return nil
-}
-
-func testClientStream(cli greettriple.GreetService) error {
- logger.Info("start to test TRIPLE client stream")
- stream, err := cli.GreetClientStream(context.Background())
- if err != nil {
- return err
- }
- for i := 0; i < 5; i++ {
- if sendErr := stream.Send(&greet.GreetClientStreamRequest{Name:
"triple"}); sendErr != nil {
- return sendErr
- }
- }
- resp, err := stream.CloseAndRecv()
- if err != nil {
- return err
- }
- logger.Infof("TRIPLE client stream resp: %s", resp.Greeting)
- return nil
-}
-
-func testServerStream(cli greettriple.GreetService) error {
- logger.Info("start to test TRIPLE server stream")
- stream, err := cli.GreetServerStream(context.Background(),
&greet.GreetServerStreamRequest{Name: "triple"})
- if err != nil {
- return err
- }
- for stream.Recv() {
- logger.Infof("TRIPLE server stream resp: %s",
stream.Msg().Greeting)
- }
- if stream.Err() != nil {
- return err
- }
- if err := stream.Close(); err != nil {
- return err
- }
- return nil
-}
diff --git a/protocol/triple/internal/client/health_client/main.go
b/protocol/triple/internal/client/health_client/main.go
deleted file mode 100644
index 7fc0dc2bd..000000000
--- a/protocol/triple/internal/client/health_client/main.go
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "context"
-)
-
-import (
- "github.com/dubbogo/gost/log/logger"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3/client"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
- health
"dubbo.apache.org/dubbo-go/v3/protocol/triple/health/triple_health"
-)
-
-func main() {
- cli, err := client.NewClient(
- client.WithClientURL("tri://127.0.0.1:20000"),
- )
- if err != nil {
- panic(err)
- }
- svc, err := health.NewHealth(cli)
- if err != nil {
- panic(err)
- }
-
- check, err := svc.Check(context.Background(),
&health.HealthCheckRequest{Service: "grpc.health.v1.Health"})
- if err != nil {
- logger.Error(err)
- } else {
- logger.Info("grpc.health.v1.Health's health", check.String())
- }
- check, err = svc.Check(context.Background(),
&health.HealthCheckRequest{Service: "greet.GreetService"})
- if err != nil {
- logger.Error(err)
- } else {
- logger.Info("greet.GreetService's health", check.String())
- }
-
- watch, err := svc.Watch(context.Background(),
&health.HealthCheckRequest{Service: "grpc.health.v1.Health"})
- if err != nil {
- logger.Error(err)
- } else {
- if watch.Recv() {
- logger.Info("grpc.health.v1.Health's health",
watch.Msg().String())
- }
- }
- watch, err = svc.Watch(context.Background(),
&health.HealthCheckRequest{Service: "greet.GreetService"})
- if err != nil {
- logger.Error(err)
- } else {
- if watch.Recv() {
- logger.Info("greet.GreetService's health",
watch.Msg().String())
- }
- }
-}
diff --git a/protocol/triple/internal/client/reflection_client/main.go
b/protocol/triple/internal/client/reflection_client/main.go
deleted file mode 100644
index 036dc2717..000000000
--- a/protocol/triple/internal/client/reflection_client/main.go
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "context"
-)
-
-import (
- "github.com/dubbogo/gost/log/logger"
-
- "github.com/golang/protobuf/proto"
-
- "google.golang.org/protobuf/types/descriptorpb"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3/client"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
- reflection
"dubbo.apache.org/dubbo-go/v3/protocol/triple/reflection/triple_reflection"
-)
-
-func main() {
- cli, err := client.NewClient(
- client.WithClientURL("tri://127.0.0.1:20000"),
- )
- if err != nil {
- panic(err)
- }
- svc, err := reflection.NewServerReflection(cli)
- if err != nil {
- panic(err)
- }
- stream, err := svc.ServerReflectionInfo(context.Background())
- if err != nil {
- panic(err)
- }
- testReflection(stream)
-}
-
-func testReflection(stream
reflection.ServerReflection_ServerReflectionInfoClient) {
- if err := testFileByFilename(stream); err != nil {
- logger.Error(err)
- }
- if err := testFileContainingSymbol(stream); err != nil {
- logger.Error(err)
- }
- if err := testListServices(stream); err != nil {
- logger.Error(err)
- }
- if err := stream.CloseRequest(); err != nil {
- logger.Error(err)
- }
- if err := stream.CloseResponse(); err != nil {
- logger.Error(err)
- }
-}
-
-func testFileByFilename(stream
reflection.ServerReflection_ServerReflectionInfoClient) error {
- logger.Info("start to test call FileByFilename")
- if err := stream.Send(&reflection.ServerReflectionRequest{
- MessageRequest:
&reflection.ServerReflectionRequest_FileByFilename{FileByFilename:
"reflection.proto"},
- }); err != nil {
- return err
- }
- recv, err := stream.Recv()
- if err != nil {
- return err
- }
- m := new(descriptorpb.FileDescriptorProto)
- if err =
proto.Unmarshal(recv.GetFileDescriptorResponse().GetFileDescriptorProto()[0],
m); err != nil {
- return err
- }
- logger.Infof("call FileByFilename 's resp : %s", m)
- return nil
-}
-
-func testFileContainingSymbol(stream
reflection.ServerReflection_ServerReflectionInfoClient) error {
- logger.Info("start to test call FileContainingSymbol")
- if err := stream.Send(&reflection.ServerReflectionRequest{
- MessageRequest:
&reflection.ServerReflectionRequest_FileContainingSymbol{FileContainingSymbol:
"dubbo.reflection.v1alpha.ServerReflection"},
- }); err != nil {
- return err
- }
- recv, err := stream.Recv()
- if err != nil {
- return err
- }
- m := new(descriptorpb.FileDescriptorProto)
- if err =
proto.Unmarshal(recv.GetFileDescriptorResponse().GetFileDescriptorProto()[0],
m); err != nil {
- return err
- }
- logger.Infof("call FileContainingSymbol 's resp : %s", m)
- return nil
-}
-
-func testListServices(stream
reflection.ServerReflection_ServerReflectionInfoClient) error {
- logger.Info("start to test call ListServices")
- if err := stream.Send(&reflection.ServerReflectionRequest{
- MessageRequest:
&reflection.ServerReflectionRequest_ListServices{},
- }); err != nil {
- return err
- }
- recv, err := stream.Recv()
- if err != nil {
- return err
- }
- logger.Infof("call ListServices 's resp : %s",
recv.GetListServicesResponse().GetService())
- return nil
-}
diff --git a/protocol/triple/internal/dubbo3_server/api/greet_service.go
b/protocol/triple/internal/dubbo3_server/api/greet_service.go
deleted file mode 100644
index d3b080e00..000000000
--- a/protocol/triple/internal/dubbo3_server/api/greet_service.go
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package api
-
-import (
- "context"
- "fmt"
- "io"
- "strings"
-)
-
-import (
- "github.com/pkg/errors"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto"
- greet
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/dubbo3_gen"
-)
-
-type GreetDubbo3Server struct {
- greet.UnimplementedGreetServiceServer
-}
-
-func (srv *GreetDubbo3Server) Greet(ctx context.Context, req
*proto.GreetRequest) (*proto.GreetResponse, error) {
- return &proto.GreetResponse{Greeting: req.Name}, nil
-}
-
-func (srv *GreetDubbo3Server) GreetStream(stream
greet.GreetService_GreetStreamServer) error {
- for {
- req, err := stream.Recv()
- if err != nil {
- if errors.Is(err, io.EOF) {
- break
- }
- return fmt.Errorf("dubbo3 Bidistream recv error: %s",
err)
- }
- if err := stream.Send(&proto.GreetStreamResponse{Greeting:
req.Name}); err != nil {
- return fmt.Errorf("dubbo3 Bidistream send error: %s",
err)
- }
- }
- return nil
-}
-
-func (srv *GreetDubbo3Server) GreetClientStream(stream
greet.GreetService_GreetClientStreamServer) error {
- var reqs []string
- for {
- req, err := stream.Recv()
- if err != nil {
- if errors.Is(err, io.EOF) {
- break
- }
- return fmt.Errorf("dubbo3 ClientStream recv error: %s",
err)
- }
- reqs = append(reqs, req.Name)
- }
-
- resp := &proto.GreetClientStreamResponse{
- Greeting: strings.Join(reqs, ","),
- }
- return stream.SendAndClose(resp)
-}
-
-func (srv *GreetDubbo3Server) GreetServerStream(req
*proto.GreetServerStreamRequest, stream
greet.GreetService_GreetServerStreamServer) error {
- for i := 0; i < 5; i++ {
- if err :=
stream.Send(&proto.GreetServerStreamResponse{Greeting: req.Name}); err != nil {
- return fmt.Errorf("dubbo3 ServerStream send error: %s",
err)
- }
- }
- return nil
-}
-
-const (
- GroupVersionIdentifier = "g1v1"
-)
-
-type GreetDubbo3ServerGroup1Version1 struct {
- greet.UnimplementedGreetServiceServer
-}
-
-func (srv *GreetDubbo3ServerGroup1Version1) Greet(ctx context.Context, req
*proto.GreetRequest) (*proto.GreetResponse, error) {
- return &proto.GreetResponse{Greeting: GroupVersionIdentifier +
req.Name}, nil
-}
-
-func (srv *GreetDubbo3ServerGroup1Version1) GreetStream(stream
greet.GreetService_GreetStreamServer) error {
- for {
- req, err := stream.Recv()
- if err != nil {
- if errors.Is(err, io.EOF) {
- break
- }
- return fmt.Errorf("dubbo3 Bidistream recv error: %s",
err)
- }
- if err := stream.Send(&proto.GreetStreamResponse{Greeting:
GroupVersionIdentifier + req.Name}); err != nil {
- return fmt.Errorf("dubbo3 Bidistream send error: %s",
err)
- }
- }
- return nil
-}
-
-func (srv *GreetDubbo3ServerGroup1Version1) GreetClientStream(stream
greet.GreetService_GreetClientStreamServer) error {
- var reqs []string
- for {
- req, err := stream.Recv()
- if err != nil {
- if errors.Is(err, io.EOF) {
- break
- }
- return fmt.Errorf("dubbo3 ClientStream recv error: %s",
err)
- }
- reqs = append(reqs, GroupVersionIdentifier+req.Name)
- }
-
- resp := &proto.GreetClientStreamResponse{
- Greeting: strings.Join(reqs, ","),
- }
- return stream.SendAndClose(resp)
-}
-
-func (srv *GreetDubbo3ServerGroup1Version1) GreetServerStream(req
*proto.GreetServerStreamRequest, stream
greet.GreetService_GreetServerStreamServer) error {
- for i := 0; i < 5; i++ {
- if err :=
stream.Send(&proto.GreetServerStreamResponse{Greeting: GroupVersionIdentifier +
req.Name}); err != nil {
- return fmt.Errorf("dubbo3 ServerStream send error: %s",
err)
- }
- }
- return nil
-}
diff --git a/protocol/triple/internal/dubbo3_server/cmd/dubbogo.yml
b/protocol/triple/internal/dubbo3_server/cmd/dubbogo.yml
deleted file mode 100644
index a3a562ff0..000000000
--- a/protocol/triple/internal/dubbo3_server/cmd/dubbogo.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-dubbo:
-# registries:
-# zk:
-# address: zookeeper://127.0.0.1:2181
- protocols:
- triple:
- name: tri
- port: 20001
- provider:
- services:
- GreetDubbo3Server:
- # interface is for registry
- interface: greet.GreetService
\ No newline at end of file
diff --git a/protocol/triple/internal/dubbo3_server/cmd/main.go
b/protocol/triple/internal/dubbo3_server/cmd/main.go
deleted file mode 100644
index 4713248f3..000000000
--- a/protocol/triple/internal/dubbo3_server/cmd/main.go
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "dubbo.apache.org/dubbo-go/v3/config"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
-
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/dubbo3_server/api"
-)
-
-func main() {
- config.SetProviderService(&api.GreetDubbo3Server{})
- if err := config.Load(config.WithPath("./dubbogo.yml")); err != nil {
- panic(err)
- }
- select {}
-}
diff --git a/protocol/triple/internal/proto/dubbo3_gen/greet_triple.pb.go
b/protocol/triple/internal/proto/dubbo3_gen/greet_triple.pb.go
deleted file mode 100644
index 5d6b31843..000000000
--- a/protocol/triple/internal/proto/dubbo3_gen/greet_triple.pb.go
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Code generated by protoc-gen-go-triple. DO NOT EDIT.
-// versions:
-// - protoc-gen-go-triple v1.0.5
-// - protoc v3.20.3
-// source: greet.proto
-
-package greet
-
-import (
- context "context"
- fmt "fmt"
-)
-
-import (
- grpc_go "github.com/dubbogo/grpc-go"
- codes "github.com/dubbogo/grpc-go/codes"
- metadata "github.com/dubbogo/grpc-go/metadata"
- status "github.com/dubbogo/grpc-go/status"
-
- common "github.com/dubbogo/triple/pkg/common"
- constant "github.com/dubbogo/triple/pkg/common/constant"
- triple "github.com/dubbogo/triple/pkg/triple"
-)
-
-import (
- protocol "dubbo.apache.org/dubbo-go/v3/protocol"
- dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
- invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
- "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto"
-)
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-const _ = grpc_go.SupportPackageIsVersion7
-
-// GreetServiceClient is the client API for GreetService service.
-//
-// For semantics around ctx use and closing/ending streaming RPCs, please
refer to
https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
-type GreetServiceClient interface {
- Greet(ctx context.Context, in *proto.GreetRequest, opts
...grpc_go.CallOption) (*proto.GreetResponse, common.ErrorWithAttachment)
- GreetStream(ctx context.Context, opts ...grpc_go.CallOption)
(GreetService_GreetStreamClient, error)
- GreetClientStream(ctx context.Context, opts ...grpc_go.CallOption)
(GreetService_GreetClientStreamClient, error)
- GreetServerStream(ctx context.Context, in
*proto.GreetServerStreamRequest, opts ...grpc_go.CallOption)
(GreetService_GreetServerStreamClient, error)
-}
-
-type greetServiceClient struct {
- cc *triple.TripleConn
-}
-
-type GreetServiceClientImpl struct {
- Greet func(ctx context.Context, in *proto.GreetRequest)
(*proto.GreetResponse, error)
- GreetStream func(ctx context.Context)
(GreetService_GreetStreamClient, error)
- GreetClientStream func(ctx context.Context)
(GreetService_GreetClientStreamClient, error)
- GreetServerStream func(ctx context.Context, in
*proto.GreetServerStreamRequest) (GreetService_GreetServerStreamClient, error)
-}
-
-func (c *GreetServiceClientImpl) GetDubboStub(cc *triple.TripleConn)
GreetServiceClient {
- return NewGreetServiceClient(cc)
-}
-
-func (c *GreetServiceClientImpl) XXX_InterfaceName() string {
- return "greet.GreetService"
-}
-
-func NewGreetServiceClient(cc *triple.TripleConn) GreetServiceClient {
- return &greetServiceClient{cc}
-}
-
-func (c *greetServiceClient) Greet(ctx context.Context, in
*proto.GreetRequest, opts ...grpc_go.CallOption) (*proto.GreetResponse,
common.ErrorWithAttachment) {
- out := new(proto.GreetResponse)
- interfaceKey := ctx.Value(constant.InterfaceKey).(string)
- return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Greet", in, out)
-}
-
-func (c *greetServiceClient) GreetStream(ctx context.Context, opts
...grpc_go.CallOption) (GreetService_GreetStreamClient, error) {
- interfaceKey := ctx.Value(constant.InterfaceKey).(string)
- stream, err := c.cc.NewStream(ctx, "/"+interfaceKey+"/GreetStream",
opts...)
- if err != nil {
- return nil, err
- }
- x := &greetServiceGreetStreamClient{stream}
- return x, nil
-}
-
-type GreetService_GreetStreamClient interface {
- Send(*proto.GreetStreamRequest) error
- Recv() (*proto.GreetStreamResponse, error)
- grpc_go.ClientStream
-}
-
-type greetServiceGreetStreamClient struct {
- grpc_go.ClientStream
-}
-
-func (x *greetServiceGreetStreamClient) Send(m *proto.GreetStreamRequest)
error {
- return x.ClientStream.SendMsg(m)
-}
-
-func (x *greetServiceGreetStreamClient) Recv() (*proto.GreetStreamResponse,
error) {
- m := new(proto.GreetStreamResponse)
- if err := x.ClientStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-func (c *greetServiceClient) GreetClientStream(ctx context.Context, opts
...grpc_go.CallOption) (GreetService_GreetClientStreamClient, error) {
- interfaceKey := ctx.Value(constant.InterfaceKey).(string)
- stream, err := c.cc.NewStream(ctx,
"/"+interfaceKey+"/GreetClientStream", opts...)
- if err != nil {
- return nil, err
- }
- x := &greetServiceGreetClientStreamClient{stream}
- return x, nil
-}
-
-type GreetService_GreetClientStreamClient interface {
- Send(*proto.GreetClientStreamRequest) error
- CloseAndRecv() (*proto.GreetClientStreamResponse, error)
- grpc_go.ClientStream
-}
-
-type greetServiceGreetClientStreamClient struct {
- grpc_go.ClientStream
-}
-
-func (x *greetServiceGreetClientStreamClient) Send(m
*proto.GreetClientStreamRequest) error {
- return x.ClientStream.SendMsg(m)
-}
-
-func (x *greetServiceGreetClientStreamClient) CloseAndRecv()
(*proto.GreetClientStreamResponse, error) {
- if err := x.ClientStream.CloseSend(); err != nil {
- return nil, err
- }
- m := new(proto.GreetClientStreamResponse)
- if err := x.ClientStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-func (c *greetServiceClient) GreetServerStream(ctx context.Context, in
*proto.GreetServerStreamRequest, opts ...grpc_go.CallOption)
(GreetService_GreetServerStreamClient, error) {
- interfaceKey := ctx.Value(constant.InterfaceKey).(string)
- stream, err := c.cc.NewStream(ctx,
"/"+interfaceKey+"/GreetServerStream", opts...)
- if err != nil {
- return nil, err
- }
- x := &greetServiceGreetServerStreamClient{stream}
- if err := x.ClientStream.SendMsg(in); err != nil {
- return nil, err
- }
- if err := x.ClientStream.CloseSend(); err != nil {
- return nil, err
- }
- return x, nil
-}
-
-type GreetService_GreetServerStreamClient interface {
- Recv() (*proto.GreetServerStreamResponse, error)
- grpc_go.ClientStream
-}
-
-type greetServiceGreetServerStreamClient struct {
- grpc_go.ClientStream
-}
-
-func (x *greetServiceGreetServerStreamClient) Recv()
(*proto.GreetServerStreamResponse, error) {
- m := new(proto.GreetServerStreamResponse)
- if err := x.ClientStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-// GreetServiceServer is the server API for GreetService service.
-// All implementations must embed UnimplementedGreetServiceServer
-// for forward compatibility
-type GreetServiceServer interface {
- Greet(context.Context, *proto.GreetRequest) (*proto.GreetResponse,
error)
- GreetStream(GreetService_GreetStreamServer) error
- GreetClientStream(GreetService_GreetClientStreamServer) error
- GreetServerStream(*proto.GreetServerStreamRequest,
GreetService_GreetServerStreamServer) error
- mustEmbedUnimplementedGreetServiceServer()
-}
-
-// UnimplementedGreetServiceServer must be embedded to have forward compatible
implementations.
-type UnimplementedGreetServiceServer struct {
- proxyImpl protocol.Invoker
-}
-
-func (UnimplementedGreetServiceServer) Greet(context.Context,
*proto.GreetRequest) (*proto.GreetResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method Greet not
implemented")
-}
-func (UnimplementedGreetServiceServer)
GreetStream(GreetService_GreetStreamServer) error {
- return status.Errorf(codes.Unimplemented, "method GreetStream not
implemented")
-}
-func (UnimplementedGreetServiceServer)
GreetClientStream(GreetService_GreetClientStreamServer) error {
- return status.Errorf(codes.Unimplemented, "method GreetClientStream not
implemented")
-}
-func (UnimplementedGreetServiceServer)
GreetServerStream(*proto.GreetServerStreamRequest,
GreetService_GreetServerStreamServer) error {
- return status.Errorf(codes.Unimplemented, "method GreetServerStream not
implemented")
-}
-func (s *UnimplementedGreetServiceServer) XXX_SetProxyImpl(impl
protocol.Invoker) {
- s.proxyImpl = impl
-}
-
-func (s *UnimplementedGreetServiceServer) XXX_GetProxyImpl() protocol.Invoker {
- return s.proxyImpl
-}
-
-func (s *UnimplementedGreetServiceServer) XXX_ServiceDesc()
*grpc_go.ServiceDesc {
- return &GreetService_ServiceDesc
-}
-func (s *UnimplementedGreetServiceServer) XXX_InterfaceName() string {
- return "greet.GreetService"
-}
-
-func (UnimplementedGreetServiceServer)
mustEmbedUnimplementedGreetServiceServer() {}
-
-// UnsafeGreetServiceServer may be embedded to opt out of forward
compatibility for this service.
-// Use of this interface is not recommended, as added methods to
GreetServiceServer will
-// result in compilation errors.
-type UnsafeGreetServiceServer interface {
- mustEmbedUnimplementedGreetServiceServer()
-}
-
-func RegisterGreetServiceServer(s grpc_go.ServiceRegistrar, srv
GreetServiceServer) {
- s.RegisterService(&GreetService_ServiceDesc, srv)
-}
-
-func _GreetService_Greet_Handler(srv interface{}, ctx context.Context, dec
func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor)
(interface{}, error) {
- in := new(proto.GreetRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- base := srv.(dubbo3.Dubbo3GrpcService)
- args := []interface{}{}
- args = append(args, in)
- md, _ := metadata.FromIncomingContext(ctx)
- invAttachment := make(map[string]interface{}, len(md))
- for k, v := range md {
- invAttachment[k] = v
- }
- invo := invocation.NewRPCInvocation("Greet", args, invAttachment)
- if interceptor == nil {
- result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
- return result, result.Error()
- }
- info := &grpc_go.UnaryServerInfo{
- Server: srv,
- FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
- }
- handler := func(ctx context.Context, req interface{}) (interface{},
error) {
- result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
- return result, result.Error()
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _GreetService_GreetStream_Handler(srv interface{}, stream
grpc_go.ServerStream) error {
- _, ok := srv.(dubbo3.Dubbo3GrpcService)
- invo := invocation.NewRPCInvocation("GreetStream", nil, nil)
- if !ok {
- fmt.Println(invo)
- return nil
- }
- return
srv.(GreetServiceServer).GreetStream(&greetServiceGreetStreamServer{stream})
-}
-
-type GreetService_GreetStreamServer interface {
- Send(*proto.GreetStreamResponse) error
- Recv() (*proto.GreetStreamRequest, error)
- grpc_go.ServerStream
-}
-
-type greetServiceGreetStreamServer struct {
- grpc_go.ServerStream
-}
-
-func (x *greetServiceGreetStreamServer) Send(m *proto.GreetStreamResponse)
error {
- return x.ServerStream.SendMsg(m)
-}
-
-func (x *greetServiceGreetStreamServer) Recv() (*proto.GreetStreamRequest,
error) {
- m := new(proto.GreetStreamRequest)
- if err := x.ServerStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-func _GreetService_GreetClientStream_Handler(srv interface{}, stream
grpc_go.ServerStream) error {
- _, ok := srv.(dubbo3.Dubbo3GrpcService)
- invo := invocation.NewRPCInvocation("GreetClientStream", nil, nil)
- if !ok {
- fmt.Println(invo)
- return nil
- }
- return
srv.(GreetServiceServer).GreetClientStream(&greetServiceGreetClientStreamServer{stream})
-}
-
-type GreetService_GreetClientStreamServer interface {
- SendAndClose(*proto.GreetClientStreamResponse) error
- Recv() (*proto.GreetClientStreamRequest, error)
- grpc_go.ServerStream
-}
-
-type greetServiceGreetClientStreamServer struct {
- grpc_go.ServerStream
-}
-
-func (x *greetServiceGreetClientStreamServer) SendAndClose(m
*proto.GreetClientStreamResponse) error {
- return x.ServerStream.SendMsg(m)
-}
-
-func (x *greetServiceGreetClientStreamServer) Recv()
(*proto.GreetClientStreamRequest, error) {
- m := new(proto.GreetClientStreamRequest)
- if err := x.ServerStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-func _GreetService_GreetServerStream_Handler(srv interface{}, stream
grpc_go.ServerStream) error {
- _, ok := srv.(dubbo3.Dubbo3GrpcService)
- invo := invocation.NewRPCInvocation("GreetServerStream", nil, nil)
- if !ok {
- fmt.Println(invo)
- return nil
- }
- m := new(proto.GreetServerStreamRequest)
- if err := stream.RecvMsg(m); err != nil {
- return err
- }
- return srv.(GreetServiceServer).GreetServerStream(m,
&greetServiceGreetServerStreamServer{stream})
-}
-
-type GreetService_GreetServerStreamServer interface {
- Send(*proto.GreetServerStreamResponse) error
- grpc_go.ServerStream
-}
-
-type greetServiceGreetServerStreamServer struct {
- grpc_go.ServerStream
-}
-
-func (x *greetServiceGreetServerStreamServer) Send(m
*proto.GreetServerStreamResponse) error {
- return x.ServerStream.SendMsg(m)
-}
-
-// GreetService_ServiceDesc is the grpc_go.ServiceDesc for GreetService
service.
-// It's only intended for direct use with grpc_go.RegisterService,
-// and not to be introspected or modified (even as a copy)
-var GreetService_ServiceDesc = grpc_go.ServiceDesc{
- ServiceName: "greet.GreetService",
- HandlerType: (*GreetServiceServer)(nil),
- Methods: []grpc_go.MethodDesc{
- {
- MethodName: "Greet",
- Handler: _GreetService_Greet_Handler,
- },
- },
- Streams: []grpc_go.StreamDesc{
- {
- StreamName: "GreetStream",
- Handler: _GreetService_GreetStream_Handler,
- ServerStreams: true,
- ClientStreams: true,
- },
- {
- StreamName: "GreetClientStream",
- Handler: _GreetService_GreetClientStream_Handler,
- ClientStreams: true,
- },
- {
- StreamName: "GreetServerStream",
- Handler: _GreetService_GreetServerStream_Handler,
- ServerStreams: true,
- },
- },
- Metadata: "greet.proto",
-}
diff --git a/protocol/triple/internal/proto/greet.pb.go
b/protocol/triple/internal/proto/greet.pb.go
deleted file mode 100644
index cfd47072b..000000000
--- a/protocol/triple/internal/proto/greet.pb.go
+++ /dev/null
@@ -1,637 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// protoc-gen-go v1.30.0
-// protoc v3.20.3
-// source: greet.proto
-
-package proto
-
-import (
- reflect "reflect"
- sync "sync"
-)
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
-)
-
-const (
- // Verify that this generated code is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
- // Verify that runtime/protoimpl is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-type GreetRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Name string `protobuf:"bytes,1,opt,name=name,proto3"
json:"name,omitempty"`
-}
-
-func (x *GreetRequest) Reset() {
- *x = GreetRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_greet_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *GreetRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GreetRequest) ProtoMessage() {}
-
-func (x *GreetRequest) ProtoReflect() protoreflect.Message {
- mi := &file_greet_proto_msgTypes[0]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use GreetRequest.ProtoReflect.Descriptor instead.
-func (*GreetRequest) Descriptor() ([]byte, []int) {
- return file_greet_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *GreetRequest) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-type GreetResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3"
json:"greeting,omitempty"`
-}
-
-func (x *GreetResponse) Reset() {
- *x = GreetResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_greet_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *GreetResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GreetResponse) ProtoMessage() {}
-
-func (x *GreetResponse) ProtoReflect() protoreflect.Message {
- mi := &file_greet_proto_msgTypes[1]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use GreetResponse.ProtoReflect.Descriptor instead.
-func (*GreetResponse) Descriptor() ([]byte, []int) {
- return file_greet_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *GreetResponse) GetGreeting() string {
- if x != nil {
- return x.Greeting
- }
- return ""
-}
-
-type GreetStreamRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Name string `protobuf:"bytes,1,opt,name=name,proto3"
json:"name,omitempty"`
-}
-
-func (x *GreetStreamRequest) Reset() {
- *x = GreetStreamRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_greet_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *GreetStreamRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GreetStreamRequest) ProtoMessage() {}
-
-func (x *GreetStreamRequest) ProtoReflect() protoreflect.Message {
- mi := &file_greet_proto_msgTypes[2]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use GreetStreamRequest.ProtoReflect.Descriptor instead.
-func (*GreetStreamRequest) Descriptor() ([]byte, []int) {
- return file_greet_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *GreetStreamRequest) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-type GreetStreamResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3"
json:"greeting,omitempty"`
-}
-
-func (x *GreetStreamResponse) Reset() {
- *x = GreetStreamResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_greet_proto_msgTypes[3]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *GreetStreamResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GreetStreamResponse) ProtoMessage() {}
-
-func (x *GreetStreamResponse) ProtoReflect() protoreflect.Message {
- mi := &file_greet_proto_msgTypes[3]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use GreetStreamResponse.ProtoReflect.Descriptor instead.
-func (*GreetStreamResponse) Descriptor() ([]byte, []int) {
- return file_greet_proto_rawDescGZIP(), []int{3}
-}
-
-func (x *GreetStreamResponse) GetGreeting() string {
- if x != nil {
- return x.Greeting
- }
- return ""
-}
-
-type GreetClientStreamRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Name string `protobuf:"bytes,1,opt,name=name,proto3"
json:"name,omitempty"`
-}
-
-func (x *GreetClientStreamRequest) Reset() {
- *x = GreetClientStreamRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_greet_proto_msgTypes[4]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *GreetClientStreamRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GreetClientStreamRequest) ProtoMessage() {}
-
-func (x *GreetClientStreamRequest) ProtoReflect() protoreflect.Message {
- mi := &file_greet_proto_msgTypes[4]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use GreetClientStreamRequest.ProtoReflect.Descriptor instead.
-func (*GreetClientStreamRequest) Descriptor() ([]byte, []int) {
- return file_greet_proto_rawDescGZIP(), []int{4}
-}
-
-func (x *GreetClientStreamRequest) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-type GreetClientStreamResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3"
json:"greeting,omitempty"`
-}
-
-func (x *GreetClientStreamResponse) Reset() {
- *x = GreetClientStreamResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_greet_proto_msgTypes[5]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *GreetClientStreamResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GreetClientStreamResponse) ProtoMessage() {}
-
-func (x *GreetClientStreamResponse) ProtoReflect() protoreflect.Message {
- mi := &file_greet_proto_msgTypes[5]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use GreetClientStreamResponse.ProtoReflect.Descriptor instead.
-func (*GreetClientStreamResponse) Descriptor() ([]byte, []int) {
- return file_greet_proto_rawDescGZIP(), []int{5}
-}
-
-func (x *GreetClientStreamResponse) GetGreeting() string {
- if x != nil {
- return x.Greeting
- }
- return ""
-}
-
-type GreetServerStreamRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Name string `protobuf:"bytes,1,opt,name=name,proto3"
json:"name,omitempty"`
-}
-
-func (x *GreetServerStreamRequest) Reset() {
- *x = GreetServerStreamRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_greet_proto_msgTypes[6]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *GreetServerStreamRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GreetServerStreamRequest) ProtoMessage() {}
-
-func (x *GreetServerStreamRequest) ProtoReflect() protoreflect.Message {
- mi := &file_greet_proto_msgTypes[6]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use GreetServerStreamRequest.ProtoReflect.Descriptor instead.
-func (*GreetServerStreamRequest) Descriptor() ([]byte, []int) {
- return file_greet_proto_rawDescGZIP(), []int{6}
-}
-
-func (x *GreetServerStreamRequest) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-type GreetServerStreamResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3"
json:"greeting,omitempty"`
-}
-
-func (x *GreetServerStreamResponse) Reset() {
- *x = GreetServerStreamResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_greet_proto_msgTypes[7]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *GreetServerStreamResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GreetServerStreamResponse) ProtoMessage() {}
-
-func (x *GreetServerStreamResponse) ProtoReflect() protoreflect.Message {
- mi := &file_greet_proto_msgTypes[7]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use GreetServerStreamResponse.ProtoReflect.Descriptor instead.
-func (*GreetServerStreamResponse) Descriptor() ([]byte, []int) {
- return file_greet_proto_rawDescGZIP(), []int{7}
-}
-
-func (x *GreetServerStreamResponse) GetGreeting() string {
- if x != nil {
- return x.Greeting
- }
- return ""
-}
-
-var File_greet_proto protoreflect.FileDescriptor
-
-var file_greet_proto_rawDesc = []byte{
- 0x0a, 0x0b, 0x67, 0x72, 0x65, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x05, 0x67,
- 0x72, 0x65, 0x65, 0x74, 0x22, 0x22, 0x0a, 0x0c, 0x47, 0x72, 0x65, 0x65,
0x74, 0x52, 0x65, 0x71,
- 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x01, 0x20, 0x01,
- 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x2b, 0x0a, 0x0d,
0x47, 0x72, 0x65, 0x65,
- 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a,
0x08, 0x67, 0x72, 0x65,
- 0x65, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x67, 0x72, 0x65,
- 0x65, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x28, 0x0a, 0x12, 0x47, 0x72, 0x65,
0x65, 0x74, 0x53, 0x74,
- 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
0x12, 0x0a, 0x04, 0x6e,
- 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x22,
- 0x31, 0x0a, 0x13, 0x47, 0x72, 0x65, 0x65, 0x74, 0x53, 0x74, 0x72, 0x65,
0x61, 0x6d, 0x52, 0x65,
- 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x72,
0x65, 0x65, 0x74, 0x69,
- 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72,
0x65, 0x65, 0x74, 0x69,
- 0x6e, 0x67, 0x22, 0x2e, 0x0a, 0x18, 0x47, 0x72, 0x65, 0x65, 0x74, 0x43,
0x6c, 0x69, 0x65, 0x6e,
- 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x12,
- 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x6e, 0x61,
- 0x6d, 0x65, 0x22, 0x37, 0x0a, 0x19, 0x47, 0x72, 0x65, 0x65, 0x74, 0x43,
0x6c, 0x69, 0x65, 0x6e,
- 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12,
- 0x1a, 0x0a, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x18,
0x01, 0x20, 0x01, 0x28,
- 0x09, 0x52, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x22,
0x2e, 0x0a, 0x18, 0x47,
- 0x72, 0x65, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74,
0x72, 0x65, 0x61, 0x6d,
- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x18,
- 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22,
0x37, 0x0a, 0x19, 0x47,
- 0x72, 0x65, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74,
0x72, 0x65, 0x61, 0x6d,
- 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08,
0x67, 0x72, 0x65, 0x65,
- 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x67, 0x72, 0x65, 0x65,
- 0x74, 0x69, 0x6e, 0x67, 0x32, 0xc8, 0x02, 0x0a, 0x0c, 0x47, 0x72, 0x65,
0x65, 0x74, 0x53, 0x65,
- 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x05, 0x47, 0x72, 0x65,
0x65, 0x74, 0x12, 0x13,
- 0x2e, 0x67, 0x72, 0x65, 0x65, 0x74, 0x2e, 0x47, 0x72, 0x65, 0x65, 0x74,
0x52, 0x65, 0x71, 0x75,
- 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x67, 0x72, 0x65, 0x65, 0x74, 0x2e,
0x47, 0x72, 0x65, 0x65,
- 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
0x4a, 0x0a, 0x0b, 0x47,
- 0x72, 0x65, 0x65, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x19,
0x2e, 0x67, 0x72, 0x65,
- 0x65, 0x74, 0x2e, 0x47, 0x72, 0x65, 0x65, 0x74, 0x53, 0x74, 0x72, 0x65,
0x61, 0x6d, 0x52, 0x65,
- 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x67, 0x72, 0x65, 0x65,
0x74, 0x2e, 0x47, 0x72,
- 0x65, 0x65, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73,
- 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x5a, 0x0a, 0x11, 0x47,
0x72, 0x65, 0x65, 0x74,
- 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d,
0x12, 0x1f, 0x2e, 0x67,
- 0x72, 0x65, 0x65, 0x74, 0x2e, 0x47, 0x72, 0x65, 0x65, 0x74, 0x43, 0x6c,
0x69, 0x65, 0x6e, 0x74,
- 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x20, 0x2e,
- 0x67, 0x72, 0x65, 0x65, 0x74, 0x2e, 0x47, 0x72, 0x65, 0x65, 0x74, 0x43,
0x6c, 0x69, 0x65, 0x6e,
- 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22,
- 0x00, 0x28, 0x01, 0x12, 0x5a, 0x0a, 0x11, 0x47, 0x72, 0x65, 0x65, 0x74,
0x53, 0x65, 0x72, 0x76,
- 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1f, 0x2e, 0x67,
0x72, 0x65, 0x65, 0x74,
- 0x2e, 0x47, 0x72, 0x65, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
0x53, 0x74, 0x72, 0x65,
- 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e,
0x67, 0x72, 0x65, 0x65,
- 0x74, 0x2e, 0x47, 0x72, 0x65, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65,
0x72, 0x53, 0x74, 0x72,
- 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x00, 0x30, 0x01, 0x42,
- 0x4e, 0x5a, 0x4c, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2e, 0x61, 0x70, 0x61,
0x63, 0x68, 0x65, 0x2e,
- 0x6f, 0x72, 0x67, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x67, 0x6f,
0x2f, 0x76, 0x33, 0x2f,
- 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x74, 0x72, 0x69,
0x70, 0x6c, 0x65, 0x2f,
- 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x2f, 0x64,
- 0x75, 0x62, 0x62, 0x6f, 0x33, 0x5f, 0x67, 0x65, 0x6e, 0x3b, 0x67, 0x72,
0x65, 0x65, 0x74, 0x62,
- 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
-}
-
-var (
- file_greet_proto_rawDescOnce sync.Once
- file_greet_proto_rawDescData = file_greet_proto_rawDesc
-)
-
-func file_greet_proto_rawDescGZIP() []byte {
- file_greet_proto_rawDescOnce.Do(func() {
- file_greet_proto_rawDescData =
protoimpl.X.CompressGZIP(file_greet_proto_rawDescData)
- })
- return file_greet_proto_rawDescData
-}
-
-var file_greet_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
-var file_greet_proto_goTypes = []interface{}{
- (*GreetRequest)(nil), // 0: greet.GreetRequest
- (*GreetResponse)(nil), // 1: greet.GreetResponse
- (*GreetStreamRequest)(nil), // 2: greet.GreetStreamRequest
- (*GreetStreamResponse)(nil), // 3: greet.GreetStreamResponse
- (*GreetClientStreamRequest)(nil), // 4: greet.GreetClientStreamRequest
- (*GreetClientStreamResponse)(nil), // 5: greet.GreetClientStreamResponse
- (*GreetServerStreamRequest)(nil), // 6: greet.GreetServerStreamRequest
- (*GreetServerStreamResponse)(nil), // 7: greet.GreetServerStreamResponse
-}
-var file_greet_proto_depIdxs = []int32{
- 0, // 0: greet.GreetService.Greet:input_type -> greet.GreetRequest
- 2, // 1: greet.GreetService.GreetStream:input_type ->
greet.GreetStreamRequest
- 4, // 2: greet.GreetService.GreetClientStream:input_type ->
greet.GreetClientStreamRequest
- 6, // 3: greet.GreetService.GreetServerStream:input_type ->
greet.GreetServerStreamRequest
- 1, // 4: greet.GreetService.Greet:output_type -> greet.GreetResponse
- 3, // 5: greet.GreetService.GreetStream:output_type ->
greet.GreetStreamResponse
- 5, // 6: greet.GreetService.GreetClientStream:output_type ->
greet.GreetClientStreamResponse
- 7, // 7: greet.GreetService.GreetServerStream:output_type ->
greet.GreetServerStreamResponse
- 4, // [4:8] is the sub-list for method output_type
- 0, // [0:4] is the sub-list for method input_type
- 0, // [0:0] is the sub-list for extension type_name
- 0, // [0:0] is the sub-list for extension extendee
- 0, // [0:0] is the sub-list for field type_name
-}
-
-func init() { file_greet_proto_init() }
-func file_greet_proto_init() {
- if File_greet_proto != nil {
- return
- }
- if !protoimpl.UnsafeEnabled {
- file_greet_proto_msgTypes[0].Exporter = func(v interface{}, i
int) interface{} {
- switch v := v.(*GreetRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_greet_proto_msgTypes[1].Exporter = func(v interface{}, i
int) interface{} {
- switch v := v.(*GreetResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_greet_proto_msgTypes[2].Exporter = func(v interface{}, i
int) interface{} {
- switch v := v.(*GreetStreamRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_greet_proto_msgTypes[3].Exporter = func(v interface{}, i
int) interface{} {
- switch v := v.(*GreetStreamResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_greet_proto_msgTypes[4].Exporter = func(v interface{}, i
int) interface{} {
- switch v := v.(*GreetClientStreamRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_greet_proto_msgTypes[5].Exporter = func(v interface{}, i
int) interface{} {
- switch v := v.(*GreetClientStreamResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_greet_proto_msgTypes[6].Exporter = func(v interface{}, i
int) interface{} {
- switch v := v.(*GreetServerStreamRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_greet_proto_msgTypes[7].Exporter = func(v interface{}, i
int) interface{} {
- switch v := v.(*GreetServerStreamResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- }
- type x struct{}
- out := protoimpl.TypeBuilder{
- File: protoimpl.DescBuilder{
- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: file_greet_proto_rawDesc,
- NumEnums: 0,
- NumMessages: 8,
- NumExtensions: 0,
- NumServices: 1,
- },
- GoTypes: file_greet_proto_goTypes,
- DependencyIndexes: file_greet_proto_depIdxs,
- MessageInfos: file_greet_proto_msgTypes,
- }.Build()
- File_greet_proto = out.File
- file_greet_proto_rawDesc = nil
- file_greet_proto_goTypes = nil
- file_greet_proto_depIdxs = nil
-}
diff --git a/protocol/triple/internal/proto/greet.proto
b/protocol/triple/internal/proto/greet.proto
deleted file mode 100644
index 8547d23e6..000000000
--- a/protocol/triple/internal/proto/greet.proto
+++ /dev/null
@@ -1,44 +0,0 @@
-syntax = "proto3";
-
-package greet;
-
-option go_package =
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/dubbo3_gen;greet";
-
-message GreetRequest {
- string name = 1;
-}
-
-message GreetResponse {
- string greeting = 1;
-}
-
-message GreetStreamRequest {
- string name = 1;
-}
-
-message GreetStreamResponse {
- string greeting = 1;
-}
-
-message GreetClientStreamRequest {
- string name = 1;
-}
-
-message GreetClientStreamResponse {
- string greeting = 1;
-}
-
-message GreetServerStreamRequest {
- string name = 1;
-}
-
-message GreetServerStreamResponse {
- string greeting = 1;
-}
-
-service GreetService {
- rpc Greet(GreetRequest) returns (GreetResponse) {}
- rpc GreetStream(stream GreetStreamRequest) returns (stream
GreetStreamResponse) {}
- rpc GreetClientStream(stream GreetClientStreamRequest) returns
(GreetClientStreamResponse) {}
- rpc GreetServerStream(GreetServerStreamRequest) returns (stream
GreetServerStreamResponse) {}
-}
\ No newline at end of file
diff --git
a/protocol/triple/internal/proto/triple_gen/greettriple/greet.triple.go
b/protocol/triple/internal/proto/triple_gen/greettriple/greet.triple.go
deleted file mode 100644
index eeb15c23f..000000000
--- a/protocol/triple/internal/proto/triple_gen/greettriple/greet.triple.go
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Code generated by protoc-gen-triple. DO NOT EDIT.
-//
-// Source: protocol/triple/internal/proto/greet.proto
-
-package greettriple
-
-import (
- context "context"
- http "net/http"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3"
- client "dubbo.apache.org/dubbo-go/v3/client"
- "dubbo.apache.org/dubbo-go/v3/common"
- "dubbo.apache.org/dubbo-go/v3/common/constant"
- "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto"
- triple_protocol
"dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol"
- "dubbo.apache.org/dubbo-go/v3/server"
-)
-
-// This is a compile-time assertion to ensure that this generated file and the
Triple package
-// are compatible. If you get a compiler error that this constant is not
defined, this code was
-// generated with a version of Triple newer than the one compiled into your
binary. You can fix the
-// problem by either regenerating this code with an older version of Triple or
updating the Triple
-// version compiled into your binary.
-const _ = triple_protocol.IsAtLeastVersion0_1_0
-
-const (
- // GreetServiceName is the fully-qualified name of the GreetService
service.
- GreetServiceName = "greet.GreetService"
-)
-
-// These constants are the fully-qualified names of the RPCs defined in this
package. They're
-// exposed at runtime as procedure and as the final two segments of the HTTP
route.
-//
-// Note that these are different from the fully-qualified method names used by
-// google.golang.org/protobuf/reflect/protoreflect. To convert from these
constants to
-// reflection-formatted method names, remove the leading slash and convert the
remaining slash to a
-// period.
-const (
- // GreetServiceGreetProcedure is the fully-qualified name of the
GreetService's Greet RPC.
- GreetServiceGreetProcedure = "/greet.GreetService/Greet"
- // GreetServiceGreetStreamProcedure is the fully-qualified name of the
GreetService's GreetStream
- // RPC.
- GreetServiceGreetStreamProcedure = "/greet.GreetService/GreetStream"
- // GreetServiceGreetClientStreamProcedure is the fully-qualified name
of the GreetService's
- // GreetClientStream RPC.
- GreetServiceGreetClientStreamProcedure =
"/greet.GreetService/GreetClientStream"
- // GreetServiceGreetServerStreamProcedure is the fully-qualified name
of the GreetService's
- // GreetServerStream RPC.
- GreetServiceGreetServerStreamProcedure =
"/greet.GreetService/GreetServerStream"
-)
-
-var (
- _ GreetService_GreetStreamClient =
(*GreetServiceGreetStreamClient)(nil)
- _ GreetService_GreetClientStreamClient =
(*GreetServiceGreetClientStreamClient)(nil)
- _ GreetService_GreetServerStreamClient =
(*GreetServiceGreetServerStreamClient)(nil)
- _ GreetService = (*GreetServiceImpl)(nil)
-
- _ GreetService_GreetStreamServer =
(*GreetServiceGreetStreamServer)(nil)
- _ GreetService_GreetClientStreamServer =
(*GreetServiceGreetClientStreamServer)(nil)
- _ GreetService_GreetServerStreamServer =
(*GreetServiceGreetServerStreamServer)(nil)
-)
-
-// GreetService is a client for the greet.GreetService service.
-type GreetService interface {
- Greet(ctx context.Context, req *proto.GreetRequest, opts
...client.CallOption) (*proto.GreetResponse, error)
- GreetStream(ctx context.Context, opts ...client.CallOption)
(GreetService_GreetStreamClient, error)
- GreetClientStream(ctx context.Context, opts ...client.CallOption)
(GreetService_GreetClientStreamClient, error)
- GreetServerStream(ctx context.Context, req
*proto.GreetServerStreamRequest, opts ...client.CallOption)
(GreetService_GreetServerStreamClient, error)
-}
-
-// NewGreetService constructs a client for the greet.GreetService service.
-func NewGreetService(cli *client.Client, opts ...client.ReferenceOption)
(GreetService, error) {
- conn, err := cli.DialWithInfo("greet.GreetService",
&GreetService_ClientInfo, opts...)
- if err != nil {
- return nil, err
- }
- return &GreetServiceImpl{
- conn: conn,
- }, nil
-}
-
-func SetConsumerService(srv common.RPCService) {
- dubbo.SetConsumerServiceWithInfo(srv, &GreetService_ClientInfo)
-}
-
-// GreetServiceImpl implements GreetService.
-type GreetServiceImpl struct {
- conn *client.Connection
-}
-
-func (c *GreetServiceImpl) Greet(ctx context.Context, req *proto.GreetRequest,
opts ...client.CallOption) (*proto.GreetResponse, error) {
- resp := new(proto.GreetResponse)
- if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "Greet",
opts...); err != nil {
- return nil, err
- }
- return resp, nil
-}
-
-func (c *GreetServiceImpl) GreetStream(ctx context.Context, opts
...client.CallOption) (GreetService_GreetStreamClient, error) {
- stream, err := c.conn.CallBidiStream(ctx, "GreetStream", opts...)
- if err != nil {
- return nil, err
- }
- rawStream := stream.(*triple_protocol.BidiStreamForClient)
- return &GreetServiceGreetStreamClient{rawStream}, nil
-}
-
-func (c *GreetServiceImpl) GreetClientStream(ctx context.Context, opts
...client.CallOption) (GreetService_GreetClientStreamClient, error) {
- stream, err := c.conn.CallClientStream(ctx, "GreetClientStream",
opts...)
- if err != nil {
- return nil, err
- }
- rawStream := stream.(*triple_protocol.ClientStreamForClient)
- return &GreetServiceGreetClientStreamClient{rawStream}, nil
-}
-
-func (c *GreetServiceImpl) GreetServerStream(ctx context.Context, req
*proto.GreetServerStreamRequest, opts ...client.CallOption)
(GreetService_GreetServerStreamClient, error) {
- stream, err := c.conn.CallServerStream(ctx, req, "GreetServerStream",
opts...)
- if err != nil {
- return nil, err
- }
- rawStream := stream.(*triple_protocol.ServerStreamForClient)
- return &GreetServiceGreetServerStreamClient{rawStream}, nil
-}
-
-type GreetService_GreetStreamClient interface {
- Spec() triple_protocol.Spec
- Peer() triple_protocol.Peer
- Send(*proto.GreetStreamRequest) error
- RequestHeader() http.Header
- CloseRequest() error
- Recv() (*proto.GreetStreamResponse, error)
- ResponseHeader() http.Header
- ResponseTrailer() http.Header
- CloseResponse() error
-}
-
-type GreetServiceGreetStreamClient struct {
- *triple_protocol.BidiStreamForClient
-}
-
-func (cli *GreetServiceGreetStreamClient) Send(msg *proto.GreetStreamRequest)
error {
- return cli.BidiStreamForClient.Send(msg)
-}
-
-func (cli *GreetServiceGreetStreamClient) Recv() (*proto.GreetStreamResponse,
error) {
- msg := new(proto.GreetStreamResponse)
- if err := cli.BidiStreamForClient.Receive(msg); err != nil {
- return nil, err
- }
- return msg, nil
-}
-
-type GreetService_GreetClientStreamClient interface {
- Spec() triple_protocol.Spec
- Peer() triple_protocol.Peer
- Send(*proto.GreetClientStreamRequest) error
- RequestHeader() http.Header
- CloseAndRecv() (*proto.GreetClientStreamResponse, error)
- Conn() (triple_protocol.StreamingClientConn, error)
-}
-
-type GreetServiceGreetClientStreamClient struct {
- *triple_protocol.ClientStreamForClient
-}
-
-func (cli *GreetServiceGreetClientStreamClient) Send(msg
*proto.GreetClientStreamRequest) error {
- return cli.ClientStreamForClient.Send(msg)
-}
-
-func (cli *GreetServiceGreetClientStreamClient) CloseAndRecv()
(*proto.GreetClientStreamResponse, error) {
- msg := new(proto.GreetClientStreamResponse)
- resp := triple_protocol.NewResponse(msg)
- if err := cli.ClientStreamForClient.CloseAndReceive(resp); err != nil {
- return nil, err
- }
- return msg, nil
-}
-
-func (cli *GreetServiceGreetClientStreamClient) Conn()
(triple_protocol.StreamingClientConn, error) {
- return cli.ClientStreamForClient.Conn()
-}
-
-type GreetService_GreetServerStreamClient interface {
- Recv() bool
- ResponseHeader() http.Header
- ResponseTrailer() http.Header
- Msg() *proto.GreetServerStreamResponse
- Err() error
- Conn() (triple_protocol.StreamingClientConn, error)
- Close() error
-}
-
-type GreetServiceGreetServerStreamClient struct {
- *triple_protocol.ServerStreamForClient
-}
-
-func (cli *GreetServiceGreetServerStreamClient) Recv() bool {
- msg := new(proto.GreetServerStreamResponse)
- return cli.ServerStreamForClient.Receive(msg)
-}
-
-func (cli *GreetServiceGreetServerStreamClient) Msg()
*proto.GreetServerStreamResponse {
- msg := cli.ServerStreamForClient.Msg()
- if msg == nil {
- return new(proto.GreetServerStreamResponse)
- }
- return msg.(*proto.GreetServerStreamResponse)
-}
-
-func (cli *GreetServiceGreetServerStreamClient) Conn()
(triple_protocol.StreamingClientConn, error) {
- return cli.ServerStreamForClient.Conn()
-}
-
-var GreetService_ClientInfo = client.ClientInfo{
- InterfaceName: "greet.GreetService",
- MethodNames: []string{"Greet", "GreetStream", "GreetClientStream",
"GreetServerStream"},
- ConnectionInjectFunc: func(dubboCliRaw interface{}, conn
*client.Connection) {
- dubboCli := dubboCliRaw.(GreetServiceImpl)
- dubboCli.conn = conn
- },
-}
-
-// GreetServiceHandler is an implementation of the greet.GreetService service.
-type GreetServiceHandler interface {
- Greet(context.Context, *proto.GreetRequest) (*proto.GreetResponse,
error)
- GreetStream(context.Context, GreetService_GreetStreamServer) error
- GreetClientStream(context.Context,
GreetService_GreetClientStreamServer) (*proto.GreetClientStreamResponse, error)
- GreetServerStream(context.Context, *proto.GreetServerStreamRequest,
GreetService_GreetServerStreamServer) error
-}
-
-func SetProviderService(srv common.RPCService) {
- dubbo.SetProviderServiceWithInfo(srv, &GreetService_ServiceInfo)
-}
-
-func RegisterGreetServiceHandler(srv *server.Server, hdlr GreetServiceHandler,
opts ...server.ServiceOption) error {
- return srv.Register(hdlr, &GreetService_ServiceInfo, opts...)
-}
-
-type GreetService_GreetStreamServer interface {
- Send(*proto.GreetStreamResponse) error
- Recv() (*proto.GreetStreamRequest, error)
- Spec() triple_protocol.Spec
- Peer() triple_protocol.Peer
- RequestHeader() http.Header
- ResponseHeader() http.Header
- ResponseTrailer() http.Header
- Conn() triple_protocol.StreamingHandlerConn
-}
-
-type GreetServiceGreetStreamServer struct {
- *triple_protocol.BidiStream
-}
-
-func (srv *GreetServiceGreetStreamServer) Send(msg *proto.GreetStreamResponse)
error {
- return srv.BidiStream.Send(msg)
-}
-
-func (srv GreetServiceGreetStreamServer) Recv() (*proto.GreetStreamRequest,
error) {
- msg := new(proto.GreetStreamRequest)
- if err := srv.BidiStream.Receive(msg); err != nil {
- return nil, err
- }
- return msg, nil
-}
-
-type GreetService_GreetClientStreamServer interface {
- Spec() triple_protocol.Spec
- Peer() triple_protocol.Peer
- Recv() bool
- RequestHeader() http.Header
- Msg() *proto.GreetClientStreamRequest
- Err() error
- Conn() triple_protocol.StreamingHandlerConn
-}
-
-type GreetServiceGreetClientStreamServer struct {
- *triple_protocol.ClientStream
-}
-
-func (srv *GreetServiceGreetClientStreamServer) Recv() bool {
- msg := new(proto.GreetClientStreamRequest)
- return srv.ClientStream.Receive(msg)
-}
-
-func (srv *GreetServiceGreetClientStreamServer) Msg()
*proto.GreetClientStreamRequest {
- msgRaw := srv.ClientStream.Msg()
- if msgRaw == nil {
- return new(proto.GreetClientStreamRequest)
- }
- return msgRaw.(*proto.GreetClientStreamRequest)
-}
-
-type GreetService_GreetServerStreamServer interface {
- Send(*proto.GreetServerStreamResponse) error
- ResponseHeader() http.Header
- ResponseTrailer() http.Header
- Conn() triple_protocol.StreamingHandlerConn
-}
-
-type GreetServiceGreetServerStreamServer struct {
- *triple_protocol.ServerStream
-}
-
-func (g *GreetServiceGreetServerStreamServer) Send(msg
*proto.GreetServerStreamResponse) error {
- return g.ServerStream.Send(msg)
-}
-
-var GreetService_ServiceInfo = server.ServiceInfo{
- InterfaceName: "greet.GreetService",
- ServiceType: (*GreetServiceHandler)(nil),
- Methods: []server.MethodInfo{
- {
- Name: "Greet",
- Type: constant.CallUnary,
- ReqInitFunc: func() interface{} {
- return new(proto.GreetRequest)
- },
- MethodFunc: func(ctx context.Context, args
[]interface{}, handler interface{}) (interface{}, error) {
- req := args[0].(*proto.GreetRequest)
- res, err :=
handler.(GreetServiceHandler).Greet(ctx, req)
- if err != nil {
- return nil, err
- }
- return triple_protocol.NewResponse(res), nil
- },
- },
- {
- Name: "GreetStream",
- Type: constant.CallBidiStream,
- StreamInitFunc: func(baseStream interface{})
interface{} {
- return
&GreetServiceGreetStreamServer{baseStream.(*triple_protocol.BidiStream)}
- },
- MethodFunc: func(ctx context.Context, args
[]interface{}, handler interface{}) (interface{}, error) {
- stream :=
args[0].(GreetService_GreetStreamServer)
- if err :=
handler.(GreetServiceHandler).GreetStream(ctx, stream); err != nil {
- return nil, err
- }
- return nil, nil
- },
- },
- {
- Name: "GreetClientStream",
- Type: constant.CallClientStream,
- StreamInitFunc: func(baseStream interface{})
interface{} {
- return
&GreetServiceGreetClientStreamServer{baseStream.(*triple_protocol.ClientStream)}
- },
- MethodFunc: func(ctx context.Context, args
[]interface{}, handler interface{}) (interface{}, error) {
- stream :=
args[0].(GreetService_GreetClientStreamServer)
- res, err :=
handler.(GreetServiceHandler).GreetClientStream(ctx, stream)
- if err != nil {
- return nil, err
- }
- return triple_protocol.NewResponse(res), nil
- },
- },
- {
- Name: "GreetServerStream",
- Type: constant.CallServerStream,
- ReqInitFunc: func() interface{} {
- return new(proto.GreetServerStreamRequest)
- },
- StreamInitFunc: func(baseStream interface{})
interface{} {
- return
&GreetServiceGreetServerStreamServer{baseStream.(*triple_protocol.ServerStream)}
- },
- MethodFunc: func(ctx context.Context, args
[]interface{}, handler interface{}) (interface{}, error) {
- req := args[0].(*proto.GreetServerStreamRequest)
- stream :=
args[1].(GreetService_GreetServerStreamServer)
- if err :=
handler.(GreetServiceHandler).GreetServerStream(ctx, req, stream); err != nil {
- return nil, err
- }
- return nil, nil
- },
- },
- },
-}
diff --git a/protocol/triple/internal/server/api/greet_service.go
b/protocol/triple/internal/server/api/greet_service.go
deleted file mode 100644
index 7e0aa504c..000000000
--- a/protocol/triple/internal/server/api/greet_service.go
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package api
-
-import (
- "context"
- "fmt"
- "strings"
-)
-
-import (
- greet "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto"
-
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/triple_gen/greettriple"
- triple "dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol"
-)
-
-type GreetTripleServer struct{}
-
-func (srv *GreetTripleServer) Greet(ctx context.Context, req
*greet.GreetRequest) (*greet.GreetResponse, error) {
- resp := &greet.GreetResponse{Greeting: req.Name}
- return resp, nil
-}
-
-func (srv *GreetTripleServer) GreetStream(ctx context.Context, stream
greettriple.GreetService_GreetStreamServer) error {
- for {
- req, err := stream.Recv()
- if err != nil {
- if triple.IsEnded(err) {
- break
- }
- return fmt.Errorf("triple BidiStream recv error: %s",
err)
- }
- if err := stream.Send(&greet.GreetStreamResponse{Greeting:
req.Name}); err != nil {
- return fmt.Errorf("triple BidiStream send error: %s",
err)
- }
- }
- return nil
-}
-
-func (srv *GreetTripleServer) GreetClientStream(ctx context.Context, stream
greettriple.GreetService_GreetClientStreamServer)
(*greet.GreetClientStreamResponse, error) {
- var reqs []string
- for stream.Recv() {
- reqs = append(reqs, stream.Msg().Name)
- }
- if stream.Err() != nil && !triple.IsEnded(stream.Err()) {
- return nil, fmt.Errorf("triple ClientStream recv err: %s",
stream.Err())
- }
- resp := &greet.GreetClientStreamResponse{
- Greeting: strings.Join(reqs, ","),
- }
-
- return resp, nil
-}
-
-func (srv *GreetTripleServer) GreetServerStream(ctx context.Context, req
*greet.GreetServerStreamRequest, stream
greettriple.GreetService_GreetServerStreamServer) error {
- for i := 0; i < 5; i++ {
- if err :=
stream.Send(&greet.GreetServerStreamResponse{Greeting: req.Name}); err != nil {
- return fmt.Errorf("triple ServerStream send err: %s",
err)
- }
- }
- return nil
-}
-
-const (
- GroupVersionIdentifier = "g1v1"
-)
-
-type GreetTripleServerGroup1Version1 struct{}
-
-func (g *GreetTripleServerGroup1Version1) Greet(ctx context.Context, req
*greet.GreetRequest) (*greet.GreetResponse, error) {
- resp := &greet.GreetResponse{Greeting: GroupVersionIdentifier +
req.Name}
- return resp, nil
-}
-
-func (g *GreetTripleServerGroup1Version1) GreetStream(ctx context.Context,
stream greettriple.GreetService_GreetStreamServer) error {
- for {
- req, err := stream.Recv()
- if err != nil {
- if triple.IsEnded(err) {
- break
- }
- return fmt.Errorf("triple BidiStream recv error: %s",
err)
- }
- if err := stream.Send(&greet.GreetStreamResponse{Greeting:
GroupVersionIdentifier + req.Name}); err != nil {
- return fmt.Errorf("triple BidiStream send error: %s",
err)
- }
- }
- return nil
-}
-
-func (g *GreetTripleServerGroup1Version1) GreetClientStream(ctx
context.Context, stream greettriple.GreetService_GreetClientStreamServer)
(*greet.GreetClientStreamResponse, error) {
- var reqs []string
- for stream.Recv() {
- reqs = append(reqs, GroupVersionIdentifier+stream.Msg().Name)
- }
- if stream.Err() != nil && !triple.IsEnded(stream.Err()) {
- return nil, fmt.Errorf("triple ClientStream recv err: %s",
stream.Err())
- }
- resp := &greet.GreetClientStreamResponse{
- Greeting: strings.Join(reqs, ","),
- }
-
- return resp, nil
-}
-
-func (g *GreetTripleServerGroup1Version1) GreetServerStream(ctx
context.Context, req *greet.GreetServerStreamRequest, stream
greettriple.GreetService_GreetServerStreamServer) error {
- for i := 0; i < 5; i++ {
- if err :=
stream.Send(&greet.GreetServerStreamResponse{Greeting: GroupVersionIdentifier +
req.Name}); err != nil {
- return fmt.Errorf("triple ServerStream send err: %s",
err)
- }
- }
- return nil
-}
diff --git a/protocol/triple/internal/server/cmd_instance/main.go
b/protocol/triple/internal/server/cmd_instance/main.go
deleted file mode 100644
index d8b740ad8..000000000
--- a/protocol/triple/internal/server/cmd_instance/main.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "dubbo.apache.org/dubbo-go/v3"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
- "dubbo.apache.org/dubbo-go/v3/protocol"
-
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/triple_gen/greettriple"
- "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/server/api"
-)
-
-func main() {
- // global conception
- // configure global configurations and common modules
- ins, err := dubbo.NewInstance(
- dubbo.WithName("dubbo_test"),
- dubbo.WithProtocol(
- protocol.WithTriple(),
- protocol.WithPort(20000),
- ),
- )
- if err != nil {
- panic(err)
- }
- srv, err := ins.NewServer()
- if err != nil {
- panic(err)
- }
- if err := greettriple.RegisterGreetServiceHandler(srv,
&api.GreetTripleServer{}); err != nil {
- panic(err)
- }
- if err := srv.Serve(); err != nil {
- panic(err)
- }
-}
diff --git a/protocol/triple/internal/server/cmd_instance_with_registry/main.go
b/protocol/triple/internal/server/cmd_instance_with_registry/main.go
deleted file mode 100644
index 8e21e4c4c..000000000
--- a/protocol/triple/internal/server/cmd_instance_with_registry/main.go
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "dubbo.apache.org/dubbo-go/v3"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
- "dubbo.apache.org/dubbo-go/v3/protocol"
-
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/triple_gen/greettriple"
- "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/server/api"
- "dubbo.apache.org/dubbo-go/v3/registry"
-)
-
-func main() {
- // global conception
- // configure global configurations and common modules
- ins, err := dubbo.NewInstance(
- dubbo.WithName("dubbo_test"),
- dubbo.WithRegistry(
- registry.WithZookeeper(),
- registry.WithAddress("127.0.0.1:2181"),
- ),
- dubbo.WithProtocol(
- protocol.WithTriple(),
- protocol.WithPort(20000),
- ),
- )
- if err != nil {
- panic(err)
- }
- srv, err := ins.NewServer()
- if err != nil {
- panic(err)
- }
- if err := greettriple.RegisterGreetServiceHandler(srv,
&api.GreetTripleServer{}); err != nil {
- panic(err)
- }
- if err := srv.Serve(); err != nil {
- panic(err)
- }
-}
diff --git a/protocol/triple/internal/server/cmd_server/main.go
b/protocol/triple/internal/server/cmd_server/main.go
deleted file mode 100644
index a0d7c4dc2..000000000
--- a/protocol/triple/internal/server/cmd_server/main.go
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- _ "dubbo.apache.org/dubbo-go/v3/imports"
- "dubbo.apache.org/dubbo-go/v3/protocol"
-
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/triple_gen/greettriple"
- "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/server/api"
- "dubbo.apache.org/dubbo-go/v3/server"
-)
-
-func main() {
- srv, err := server.NewServer(
- server.WithServerProtocol(
- protocol.WithTriple(),
- protocol.WithPort(20000),
- ),
- )
-
- if err != nil {
- panic(err)
- }
- if err := greettriple.RegisterGreetServiceHandler(srv,
&api.GreetTripleServer{}); err != nil {
- panic(err)
- }
-
- if err := srv.Serve(); err != nil {
- panic(err)
- }
-}
diff --git a/protocol/triple/internal/server/cmd_server_with_registry/main.go
b/protocol/triple/internal/server/cmd_server_with_registry/main.go
deleted file mode 100644
index 67058124d..000000000
--- a/protocol/triple/internal/server/cmd_server_with_registry/main.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- _ "dubbo.apache.org/dubbo-go/v3/imports"
- "dubbo.apache.org/dubbo-go/v3/protocol"
-
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/triple_gen/greettriple"
- "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/server/api"
- "dubbo.apache.org/dubbo-go/v3/registry"
- "dubbo.apache.org/dubbo-go/v3/server"
-)
-
-func main() {
- srv, err := server.NewServer(
- server.WithServerRegistry(
- registry.WithZookeeper(),
- registry.WithAddress("127.0.0.1:2181"),
- ),
- server.WithServerProtocol(
- protocol.WithTriple(),
- protocol.WithPort(20000),
- ),
- )
- if err != nil {
- panic(err)
- }
- if err := greettriple.RegisterGreetServiceHandler(srv,
&api.GreetTripleServer{}); err != nil {
- panic(err)
- }
- if err := srv.Serve(); err != nil {
- panic(err)
- }
-}
diff --git a/protocol/triple/internal/server/cmd_with_yml/cmd/main.go
b/protocol/triple/internal/server/cmd_with_yml/cmd/main.go
deleted file mode 100644
index 4847d32a4..000000000
--- a/protocol/triple/internal/server/cmd_with_yml/cmd/main.go
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "dubbo.apache.org/dubbo-go/v3"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
-
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/triple_gen/greettriple"
- "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/server/api"
-)
-
-func main() {
- greettriple.SetProviderService(&api.GreetTripleServer{})
- if err := dubbo.Load(); err != nil {
- panic(err)
- }
- select {}
-}
diff --git a/protocol/triple/internal/server/cmd_with_yml/conf/dubbogo.yml
b/protocol/triple/internal/server/cmd_with_yml/conf/dubbogo.yml
deleted file mode 100644
index af32f36b6..000000000
--- a/protocol/triple/internal/server/cmd_with_yml/conf/dubbogo.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-# dubbo server yaml configure file
-dubbo:
- registries:
- demoZK:
- protocol: zookeeper
- address: 127.0.0.1:2181
- protocols:
- tripleProtocol:
- name: tri
- port: 20000
\ No newline at end of file
diff --git a/protocol/triple/triple_test.go b/protocol/triple/triple_test.go
deleted file mode 100644
index afef2887f..000000000
--- a/protocol/triple/triple_test.go
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package triple
-
-import (
- "context"
- "errors"
- "fmt"
- "io"
- "os"
- "reflect"
- "strings"
- "testing"
- "time"
-)
-
-import (
- grpc_go "github.com/dubbogo/grpc-go"
-
- "github.com/stretchr/testify/assert"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3/client"
- "dubbo.apache.org/dubbo-go/v3/common"
- "dubbo.apache.org/dubbo-go/v3/common/constant"
- "dubbo.apache.org/dubbo-go/v3/common/extension"
- "dubbo.apache.org/dubbo-go/v3/config"
- "dubbo.apache.org/dubbo-go/v3/protocol"
- invocation_impl "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
- dubbo3_api
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/dubbo3_server/api"
- greet "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto"
- dubbo3_greet
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/dubbo3_gen"
-
"dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/proto/triple_gen/greettriple"
- "dubbo.apache.org/dubbo-go/v3/protocol/triple/internal/server/api"
- "dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol"
- _ "dubbo.apache.org/dubbo-go/v3/proxy/proxy_factory"
-)
-
-const (
- triplePort = "21000"
- dubbo3Port = "21001"
- listenAddr = "0.0.0.0"
- localAddr = "127.0.0.1"
- name = "triple"
- group = "g1"
- version = "v1"
- customTripleInterfaceName = "apache.dubbo.org.triple"
- customDubbo3InterfaceName = "apache.dubbo.org.dubbo3"
-)
-
-type tripleInvoker struct {
- url *common.URL
- info *common.ServiceInfo
- base *protocol.BaseInvoker
- handler interface{}
-}
-
-func (t *tripleInvoker) GetURL() *common.URL {
- return t.url
-}
-
-func (t *tripleInvoker) IsAvailable() bool {
- return t.base.IsAvailable()
-}
-
-func (t *tripleInvoker) Destroy() {
- t.base.Destroy()
-}
-
-func (t *tripleInvoker) Invoke(ctx context.Context, invocation
protocol.Invocation) protocol.Result {
- name := invocation.MethodName()
- args := invocation.Arguments()
- for _, method := range t.info.Methods {
- if method.Name == name {
- res, err := method.MethodFunc(ctx, args, t.handler)
- result := new(protocol.RPCResult)
- result.SetResult(res)
- result.SetError(err)
- return result
- }
- }
- panic(fmt.Sprintf("no match method for %s", name))
-}
-
-func runTripleServer(interfaceName string, group string, version string, addr
string, info *common.ServiceInfo, handler interface{}) {
- url := common.NewURLWithOptions(
- common.WithPath(interfaceName),
- common.WithLocation(addr),
- common.WithPort(triplePort),
- common.WithProtocol(TRIPLE),
- common.WithInterface(interfaceName),
- )
- url.SetParam(constant.GroupKey, group)
- url.SetParam(constant.VersionKey, version)
- var invoker protocol.Invoker
- if info != nil {
- invoker = &tripleInvoker{
- url: url,
- info: info,
- base: protocol.NewBaseInvoker(url),
- handler: handler,
- }
- }
- GetProtocol().(*TripleProtocol).exportForTest(invoker, info)
-}
-
-func runOldTripleServer(interfaceName string, group string, version string,
addr string, desc *grpc_go.ServiceDesc, svc common.RPCService) {
- url := common.NewURLWithOptions(
- common.WithPath(interfaceName),
- common.WithLocation(addr),
- common.WithPort(dubbo3Port),
- common.WithProtocol(TRIPLE),
- common.WithInterface(interfaceName),
- )
- url.SetParam(constant.GroupKey, group)
- url.SetParam(constant.VersionKey, version)
- // todo(DMwangnima): add protocol config
- config.SetRootConfig(
- *config.NewRootConfigBuilder().
- SetProvider(
- config.NewProviderConfigBuilder().
- AddService(common.GetReference(svc),
config.NewServiceConfigBuilder().
- SetInterface(interfaceName).
- SetGroup(group).
- SetVersion(version).
- Build()).
- SetProxyFactory("default").
- Build()).
- Build())
- config.SetProviderService(svc)
- common.ServiceMap.Register(interfaceName, TRIPLE, group, version, svc)
- invoker := extension.GetProxyFactory("default").GetInvoker(url)
- GetProtocol().(*TripleProtocol).exportForTest(invoker, nil)
-}
-
-func TestMain(m *testing.M) {
- runTripleServer(
- customTripleInterfaceName,
- "",
- "",
- listenAddr,
- &greettriple.GreetService_ServiceInfo,
- new(api.GreetTripleServer),
- )
- runTripleServer(
- customTripleInterfaceName,
- group,
- version,
- listenAddr,
- &greettriple.GreetService_ServiceInfo,
- new(api.GreetTripleServerGroup1Version1),
- )
- runOldTripleServer(
- customDubbo3InterfaceName,
- "",
- "",
- listenAddr,
- &dubbo3_greet.GreetService_ServiceDesc,
- new(dubbo3_api.GreetDubbo3Server),
- )
- runOldTripleServer(
- customDubbo3InterfaceName,
- group,
- version,
- listenAddr,
- &dubbo3_greet.GreetService_ServiceDesc,
- new(dubbo3_api.GreetDubbo3ServerGroup1Version1),
- )
- time.Sleep(3 * time.Second)
- m.Run()
- os.Exit(0)
-}
-
-func TestInvoke(t *testing.T) {
- tripleInvokerInit := func(location string, port string, interfaceName
string, group string, version string, methods []string, serialization string,
info *client.ClientInfo) (protocol.Invoker, error) {
- newURL := common.NewURLWithOptions(
- common.WithInterface(interfaceName),
- common.WithLocation(location),
- common.WithPort(port),
- common.WithMethods(methods),
- common.WithAttribute(constant.ClientInfoKey, info),
- )
- newURL.SetParam(constant.GroupKey, group)
- newURL.SetParam(constant.VersionKey, version)
- newURL.SetParam(constant.SerializationKey, serialization)
- return NewTripleInvoker(newURL)
- }
- dubbo3InvokerInit := func(location string, port string, interfaceName
string, group string, version string, svc common.RPCService) (protocol.Invoker,
error) {
- newURL := common.NewURLWithOptions(
- common.WithInterface(interfaceName),
- common.WithLocation(location),
- common.WithPort(port),
- )
- newURL.SetParam(constant.GroupKey, group)
- newURL.SetParam(constant.VersionKey, version)
- // dubbo3 needs to retrieve ConsumerService directly
- config.SetConsumerServiceByInterfaceName(interfaceName, svc)
- return NewDubbo3Invoker(newURL)
- }
- tripleInvocationInit := func(methodName string, rawParams
[]interface{}, callType string) protocol.Invocation {
- newInv := invocation_impl.NewRPCInvocationWithOptions(
- invocation_impl.WithMethodName(methodName),
- invocation_impl.WithParameterRawValues(rawParams),
- )
- newInv.SetAttribute(constant.CallTypeKey, callType)
- return newInv
- }
- dubbo3InvocationInit := func(methodName string, params []reflect.Value,
reply interface{}) protocol.Invocation {
- newInv := invocation_impl.NewRPCInvocationWithOptions(
- invocation_impl.WithMethodName(methodName),
- invocation_impl.WithParameterValues(params),
- )
- newInv.SetReply(reply)
- return newInv
- }
- dubbo3ReplyInit := func(fieldType reflect.Type) interface{} {
- var reply reflect.Value
- replyType := fieldType.Out(0)
- if replyType.Kind() == reflect.Ptr {
- reply = reflect.New(replyType.Elem())
- } else {
- reply = reflect.New(replyType)
- }
- return reply.Interface()
- }
-
- invokeTripleCodeFunc := func(t *testing.T, invoker protocol.Invoker,
identifier string, isIDL bool) {
- tests := []struct {
- methodName string
- callType string
- rawParams []interface{}
- needIDL bool
- validate func(t *testing.T, rawParams []interface{},
res protocol.Result)
- }{
- {
- methodName: "Greet",
- callType: constant.CallUnary,
- rawParams: []interface{}{
- &greet.GreetRequest{
- Name: name,
- },
- &greet.GreetResponse{},
- },
- validate: func(t *testing.T, params
[]interface{}, res protocol.Result) {
- assert.Nil(t, res.Result())
- assert.Nil(t, res.Error())
- req := params[0].(*greet.GreetRequest)
- resp := params[1].(*greet.GreetResponse)
- assert.Equal(t, identifier+req.Name,
resp.Greeting)
- },
- },
- {
- methodName: "GreetClientStream",
- callType: constant.CallClientStream,
- needIDL: true,
- validate: func(t *testing.T, params
[]interface{}, res protocol.Result) {
- assert.Nil(t, res.Error())
- streamRaw, ok :=
res.Result().(*triple_protocol.ClientStreamForClient)
- assert.True(t, ok)
- stream :=
&greettriple.GreetServiceGreetClientStreamClient{ClientStreamForClient:
streamRaw}
-
- var expectRes []string
- times := 5
- for i := 1; i <= times; i++ {
- expectRes = append(expectRes,
identifier+name)
- err :=
stream.Send(&greet.GreetClientStreamRequest{Name: name})
- assert.Nil(t, err)
- }
- expectStr := strings.Join(expectRes,
",")
- resp, err := stream.CloseAndRecv()
- assert.Nil(t, err)
- assert.Equal(t, expectStr,
resp.Greeting)
- },
- },
- {
- methodName: "GreetServerStream",
- callType: constant.CallServerStream,
- rawParams: []interface{}{
- &greet.GreetServerStreamRequest{
- Name: "dubbo",
- },
- },
- needIDL: true,
- validate: func(t *testing.T, params
[]interface{}, res protocol.Result) {
- assert.Nil(t, res.Error())
- req :=
params[0].(*greet.GreetServerStreamRequest)
- streamRaw, ok :=
res.Result().(*triple_protocol.ServerStreamForClient)
- stream :=
&greettriple.GreetServiceGreetServerStreamClient{ServerStreamForClient:
streamRaw}
- assert.True(t, ok)
- times := 5
- for i := 1; i <= times; i++ {
- for stream.Recv() {
- assert.Nil(t,
stream.Err())
- assert.Equal(t,
identifier+req.Name, stream.Msg().Greeting)
- }
- assert.True(t, true,
errors.Is(stream.Err(), io.EOF))
- }
- },
- },
- {
- methodName: "GreetStream",
- callType: constant.CallBidiStream,
- needIDL: true,
- validate: func(t *testing.T, params
[]interface{}, res protocol.Result) {
- assert.Nil(t, res.Error())
- streamRaw, ok :=
res.Result().(*triple_protocol.BidiStreamForClient)
- assert.True(t, ok)
- stream :=
&greettriple.GreetServiceGreetStreamClient{BidiStreamForClient: streamRaw}
- for i := 1; i <= 5; i++ {
- err :=
stream.Send(&greet.GreetStreamRequest{Name: name})
- assert.Nil(t, err)
- resp, err := stream.Recv()
- assert.Nil(t, err)
- assert.Equal(t,
identifier+name, resp.Greeting)
- }
- assert.Nil(t, stream.CloseRequest())
- assert.Nil(t, stream.CloseResponse())
- },
- },
- }
-
- for _, test := range tests {
- if test.needIDL && !isIDL {
- continue
- }
- t.Run(test.methodName, func(t *testing.T) {
- inv := tripleInvocationInit(test.methodName,
test.rawParams, test.callType)
- res := invoker.Invoke(context.Background(), inv)
- test.validate(t, test.rawParams, res)
- })
- }
- }
- invokeDubbo3CodeFunc := func(t *testing.T, invoker protocol.Invoker,
svc common.RPCService, identifier string) {
- tests := []struct {
- methodName string
- params []reflect.Value
- validate func(t *testing.T, params []reflect.Value,
res protocol.Result)
- }{
- {
- methodName: "Greet",
- params: []reflect.Value{
- reflect.ValueOf(&greet.GreetRequest{
- Name: name,
- }),
- },
- validate: func(t *testing.T, Params
[]reflect.Value, res protocol.Result) {
- assert.Nil(t, res.Error())
- req :=
Params[0].Interface().(*greet.GreetRequest)
- resp :=
res.Result().(*greet.GreetResponse)
- assert.Equal(t, identifier+req.Name,
resp.Greeting)
- },
- },
- {
- methodName: "GreetClientStream",
- validate: func(t *testing.T, reflectParams
[]reflect.Value, res protocol.Result) {
- assert.Nil(t, res.Error())
- stream, ok :=
res.Result().(*dubbo3_greet.GreetService_GreetClientStreamClient)
- assert.True(t, ok)
-
- var expectRes []string
- times := 5
- for i := 1; i <= times; i++ {
- expectRes = append(expectRes,
identifier+name)
- err :=
(*stream).Send(&greet.GreetClientStreamRequest{Name: name})
- assert.Nil(t, err)
- }
- expectStr := strings.Join(expectRes,
",")
- resp, err := (*stream).CloseAndRecv()
- assert.Nil(t, err)
- assert.Equal(t, expectStr,
resp.Greeting)
- },
- },
- {
- methodName: "GreetServerStream",
- params: []reflect.Value{
-
reflect.ValueOf(&greet.GreetServerStreamRequest{
- Name: "dubbo",
- }),
- },
- validate: func(t *testing.T, params
[]reflect.Value, res protocol.Result) {
- assert.Nil(t, res.Error())
- req :=
params[0].Interface().(*greet.GreetServerStreamRequest)
- stream, ok :=
res.Result().(*dubbo3_greet.GreetService_GreetServerStreamClient)
- assert.True(t, ok)
- times := 5
- for i := 1; i <= times; i++ {
- msg, err := (*stream).Recv()
- assert.Nil(t, err)
- assert.Equal(t,
identifier+req.Name, msg.Greeting)
- }
- },
- },
- {
- methodName: "GreetStream",
- validate: func(t *testing.T, params
[]reflect.Value, res protocol.Result) {
- assert.Nil(t, res.Error())
- stream, ok :=
res.Result().(*dubbo3_greet.GreetService_GreetStreamClient)
- assert.True(t, ok)
- for i := 1; i <= 5; i++ {
- err :=
(*stream).Send(&greet.GreetStreamRequest{Name: name})
- assert.Nil(t, err)
- resp, err := (*stream).Recv()
- assert.Nil(t, err)
- assert.Equal(t,
identifier+name, resp.Greeting)
- }
- assert.Nil(t, (*stream).CloseSend())
- },
- },
- }
-
- svcPtrVal := reflect.ValueOf(svc)
- svcVal := svcPtrVal.Elem()
- svcType := svcVal.Type()
- for _, test := range tests {
- t.Run(test.methodName, func(t *testing.T) {
- funcField, ok :=
svcType.FieldByName(test.methodName)
- assert.True(t, ok)
- reply := dubbo3ReplyInit(funcField.Type)
- inv := dubbo3InvocationInit(test.methodName,
test.params, reply)
- res := invoker.Invoke(context.Background(), inv)
- test.validate(t, test.params, res)
- })
- }
- }
-
- t.Run("triple2triple", func(t *testing.T) {
- invoker, err := tripleInvokerInit(localAddr, triplePort,
customTripleInterfaceName, "", "",
greettriple.GreetService_ClientInfo.MethodNames, "",
&greettriple.GreetService_ClientInfo)
- assert.Nil(t, err)
- invokeTripleCodeFunc(t, invoker, "", true)
- })
- t.Run("triple2triple_JsonSerialization", func(t *testing.T) {
- invoker, err := tripleInvokerInit(localAddr, triplePort,
customTripleInterfaceName, "", "",
greettriple.GreetService_ClientInfo.MethodNames, constant.JSONSerialization,
&greettriple.GreetService_ClientInfo)
- assert.Nil(t, err)
- invokeTripleCodeFunc(t, invoker, "", true)
- })
- t.Run("triple2triple_MsgpackSerialization", func(t *testing.T) {
- invoker, err := tripleInvokerInit(localAddr, triplePort,
customTripleInterfaceName, "", "",
greettriple.GreetService_ClientInfo.MethodNames, constant.MsgpackSerialization,
&greettriple.GreetService_ClientInfo)
- assert.Nil(t, err)
- invokeTripleCodeFunc(t, invoker, "", false)
- })
- t.Run("triple2triple_Group1Version1", func(t *testing.T) {
- invoker, err := tripleInvokerInit(localAddr, triplePort,
customTripleInterfaceName, group, version,
greettriple.GreetService_ClientInfo.MethodNames, "",
&greettriple.GreetService_ClientInfo)
- assert.Nil(t, err)
- invokeTripleCodeFunc(t, invoker, api.GroupVersionIdentifier,
true)
- })
- t.Run("triple2dubbo3", func(t *testing.T) {
- invoker, err := tripleInvokerInit(localAddr, dubbo3Port,
customDubbo3InterfaceName, "", "",
greettriple.GreetService_ClientInfo.MethodNames, "",
&greettriple.GreetService_ClientInfo)
- assert.Nil(t, err)
- invokeTripleCodeFunc(t, invoker, "", true)
- })
- t.Run("triple2dubbo3_Group1Version1", func(t *testing.T) {
- invoker, err := tripleInvokerInit(localAddr, dubbo3Port,
customDubbo3InterfaceName, group, version,
greettriple.GreetService_ClientInfo.MethodNames, "",
&greettriple.GreetService_ClientInfo)
- assert.Nil(t, err)
- invokeTripleCodeFunc(t, invoker,
dubbo3_api.GroupVersionIdentifier, true)
- })
- t.Run("dubbo32triple", func(t *testing.T) {
- svc := new(dubbo3_greet.GreetServiceClientImpl)
- invoker, err := dubbo3InvokerInit(localAddr, triplePort,
customTripleInterfaceName, "", "", svc)
- assert.Nil(t, err)
- invokeDubbo3CodeFunc(t, invoker, svc, "")
- })
- t.Run("dubbo32triple_Group1Version1", func(t *testing.T) {
- svc := new(dubbo3_greet.GreetServiceClientImpl)
- invoker, err := dubbo3InvokerInit(localAddr, triplePort,
customTripleInterfaceName, group, version, svc)
- assert.Nil(t, err)
- invokeDubbo3CodeFunc(t, invoker, svc,
api.GroupVersionIdentifier)
- })
- t.Run("dubbo32dubbo3", func(t *testing.T) {
- svc := new(dubbo3_greet.GreetServiceClientImpl)
- invoker, err := dubbo3InvokerInit(localAddr, dubbo3Port,
customDubbo3InterfaceName, "", "", svc)
- assert.Nil(t, err)
- invokeDubbo3CodeFunc(t, invoker, svc, "")
- })
- t.Run("dubbo32dubbo3_Group1Version1", func(t *testing.T) {
- svc := new(dubbo3_greet.GreetServiceClientImpl)
- invoker, err := dubbo3InvokerInit(localAddr, dubbo3Port,
customDubbo3InterfaceName, group, version, svc)
- assert.Nil(t, err)
- invokeDubbo3CodeFunc(t, invoker, svc,
dubbo3_api.GroupVersionIdentifier)
- })
-}