dubbo.apache.org/dubbo-go/v3@v3.1.1/protocol/dubbo3/internal/helloworld_triple.pb.go (about)

     1  /*
     2   * Licensed to the Apache Software Foundation (ASF) under one or more
     3   * contributor license agreements.  See the NOTICE file distributed with
     4   * this work for additional information regarding copyright ownership.
     5   * The ASF licenses this file to You under the Apache License, Version 2.0
     6   * (the "License"); you may not use this file except in compliance with
     7   * the License.  You may obtain a copy of the License at
     8   *
     9   *     http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   */
    17  
    18  // Code generated by protoc-gen-go-triple. DO NOT EDIT.
    19  // versions:
    20  // - protoc-gen-go-triple v1.0.1
    21  // - protoc             v3.14.0
    22  // source: helloworld.proto
    23  
    24  package internal
    25  
    26  import (
    27  	context "context"
    28  )
    29  
    30  import (
    31  	grpc "github.com/dubbogo/grpc-go"
    32  	codes "github.com/dubbogo/grpc-go/codes"
    33  	status "github.com/dubbogo/grpc-go/status"
    34  
    35  	common "github.com/dubbogo/triple/pkg/common"
    36  	constant "github.com/dubbogo/triple/pkg/common/constant"
    37  	triple "github.com/dubbogo/triple/pkg/triple"
    38  )
    39  
    40  import (
    41  	protocol "dubbo.apache.org/dubbo-go/v3/protocol"
    42  	invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
    43  )
    44  
    45  // This is a compile-time assertion to ensure that this generated file
    46  // is compatible with the grpc package it is being compiled against.
    47  const _ = grpc.SupportPackageIsVersion7
    48  
    49  // GreeterClient is the client API for Greeter service.
    50  //
    51  // 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.
    52  type GreeterClient interface {
    53  	// Sends a greeting
    54  	SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, common.ErrorWithAttachment)
    55  }
    56  
    57  type greeterClient struct {
    58  	cc *triple.TripleConn
    59  }
    60  
    61  type GreeterClientImpl struct {
    62  	SayHello func(ctx context.Context, in *HelloRequest) (*HelloReply, error)
    63  }
    64  
    65  func (c *GreeterClientImpl) GetDubboStub(cc *triple.TripleConn) GreeterClient {
    66  	return NewGreeterClient(cc)
    67  }
    68  
    69  func NewGreeterClient(cc *triple.TripleConn) GreeterClient {
    70  	return &greeterClient{cc}
    71  }
    72  
    73  func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, common.ErrorWithAttachment) {
    74  	out := new(HelloReply)
    75  	interfaceKey := ctx.Value(constant.InterfaceKey).(string)
    76  	return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SayHello", in, out)
    77  }
    78  
    79  // GreeterServer is the server API for Greeter service.
    80  // All implementations must embed UnimplementedGreeterServer
    81  // for forward compatibility
    82  type GreeterServer interface {
    83  	// Sends a greeting
    84  	SayHello(context.Context, *HelloRequest) (*HelloReply, error)
    85  	mustEmbedUnimplementedGreeterServer()
    86  }
    87  
    88  // UnimplementedGreeterServer must be embedded to have forward compatible implementations.
    89  type UnimplementedGreeterServer struct {
    90  	proxyImpl protocol.Invoker
    91  }
    92  
    93  func (UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error) {
    94  	return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented")
    95  }
    96  func (s *UnimplementedGreeterServer) XXX_SetProxyImpl(impl protocol.Invoker) {
    97  	s.proxyImpl = impl
    98  }
    99  
   100  func (s *UnimplementedGreeterServer) XXX_GetProxyImpl() protocol.Invoker {
   101  	return s.proxyImpl
   102  }
   103  
   104  func (UnimplementedGreeterServer) mustEmbedUnimplementedGreeterServer() {}
   105  
   106  // UnsafeGreeterServer may be embedded to opt out of forward compatibility for this service.
   107  // Use of this interface is not recommended, as added methods to GreeterServer will
   108  // result in compilation errors.
   109  type UnsafeGreeterServer interface {
   110  	mustEmbedUnimplementedGreeterServer()
   111  }
   112  
   113  func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer) {
   114  	s.RegisterService(&Greeter_ServiceDesc, srv)
   115  }
   116  
   117  // Dubbo3GrpcService is gRPC service
   118  type Dubbo3GrpcService interface {
   119  	// SetProxyImpl sets proxy.
   120  	XXX_SetProxyImpl(impl protocol.Invoker)
   121  	// GetProxyImpl gets proxy.
   122  	XXX_GetProxyImpl() protocol.Invoker
   123  	// ServiceDesc gets an RPC service's specification.
   124  	XXX_ServiceDesc() *grpc.ServiceDesc
   125  }
   126  
   127  func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   128  	in := new(HelloRequest)
   129  	if err := dec(in); err != nil {
   130  		return nil, err
   131  	}
   132  	base := srv.(Dubbo3GrpcService)
   133  	args := []interface{}{}
   134  	args = append(args, in)
   135  	invo := invocation.NewRPCInvocation("SayHello", args, nil)
   136  	if interceptor == nil {
   137  		result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
   138  		return result, result.Error()
   139  	}
   140  	info := &grpc.UnaryServerInfo{
   141  		Server:     srv,
   142  		FullMethod: "/internal.Greeter/SayHello",
   143  	}
   144  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   145  		return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
   146  	}
   147  	return interceptor(ctx, in, info, handler)
   148  }
   149  
   150  // Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service.
   151  // It's only intended for direct use with grpc.RegisterService,
   152  // and not to be introspected or modified (even as a copy)
   153  var Greeter_ServiceDesc = grpc.ServiceDesc{
   154  	ServiceName: "internal.Greeter",
   155  	HandlerType: (*GreeterServer)(nil),
   156  	Methods: []grpc.MethodDesc{
   157  		{
   158  			MethodName: "SayHello",
   159  			Handler:    _Greeter_SayHello_Handler,
   160  		},
   161  	},
   162  	Streams:  []grpc.StreamDesc{},
   163  	Metadata: "helloworld.proto",
   164  }
   165  
   166  func (s *UnimplementedGreeterServer) XXX_ServiceDesc() *grpc.ServiceDesc {
   167  	return &Greeter_ServiceDesc
   168  }