github.com/hashicorp/go-plugin@v1.6.0/examples/grpc/proto/kv_grpc.pb.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
     5  // versions:
     6  // - protoc-gen-go-grpc v1.3.0
     7  // - protoc             (unknown)
     8  // source: proto/kv.proto
     9  
    10  package proto
    11  
    12  import (
    13  	context "context"
    14  	grpc "google.golang.org/grpc"
    15  	codes "google.golang.org/grpc/codes"
    16  	status "google.golang.org/grpc/status"
    17  )
    18  
    19  // This is a compile-time assertion to ensure that this generated file
    20  // is compatible with the grpc package it is being compiled against.
    21  // Requires gRPC-Go v1.32.0 or later.
    22  const _ = grpc.SupportPackageIsVersion7
    23  
    24  const (
    25  	KV_Get_FullMethodName = "/proto.KV/Get"
    26  	KV_Put_FullMethodName = "/proto.KV/Put"
    27  )
    28  
    29  // KVClient is the client API for KV service.
    30  //
    31  // 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.
    32  type KVClient interface {
    33  	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
    34  	Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*Empty, error)
    35  }
    36  
    37  type kVClient struct {
    38  	cc grpc.ClientConnInterface
    39  }
    40  
    41  func NewKVClient(cc grpc.ClientConnInterface) KVClient {
    42  	return &kVClient{cc}
    43  }
    44  
    45  func (c *kVClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) {
    46  	out := new(GetResponse)
    47  	err := c.cc.Invoke(ctx, KV_Get_FullMethodName, in, out, opts...)
    48  	if err != nil {
    49  		return nil, err
    50  	}
    51  	return out, nil
    52  }
    53  
    54  func (c *kVClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*Empty, error) {
    55  	out := new(Empty)
    56  	err := c.cc.Invoke(ctx, KV_Put_FullMethodName, in, out, opts...)
    57  	if err != nil {
    58  		return nil, err
    59  	}
    60  	return out, nil
    61  }
    62  
    63  // KVServer is the server API for KV service.
    64  // All implementations should embed UnimplementedKVServer
    65  // for forward compatibility
    66  type KVServer interface {
    67  	Get(context.Context, *GetRequest) (*GetResponse, error)
    68  	Put(context.Context, *PutRequest) (*Empty, error)
    69  }
    70  
    71  // UnimplementedKVServer should be embedded to have forward compatible implementations.
    72  type UnimplementedKVServer struct {
    73  }
    74  
    75  func (UnimplementedKVServer) Get(context.Context, *GetRequest) (*GetResponse, error) {
    76  	return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
    77  }
    78  func (UnimplementedKVServer) Put(context.Context, *PutRequest) (*Empty, error) {
    79  	return nil, status.Errorf(codes.Unimplemented, "method Put not implemented")
    80  }
    81  
    82  // UnsafeKVServer may be embedded to opt out of forward compatibility for this service.
    83  // Use of this interface is not recommended, as added methods to KVServer will
    84  // result in compilation errors.
    85  type UnsafeKVServer interface {
    86  	mustEmbedUnimplementedKVServer()
    87  }
    88  
    89  func RegisterKVServer(s grpc.ServiceRegistrar, srv KVServer) {
    90  	s.RegisterService(&KV_ServiceDesc, srv)
    91  }
    92  
    93  func _KV_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
    94  	in := new(GetRequest)
    95  	if err := dec(in); err != nil {
    96  		return nil, err
    97  	}
    98  	if interceptor == nil {
    99  		return srv.(KVServer).Get(ctx, in)
   100  	}
   101  	info := &grpc.UnaryServerInfo{
   102  		Server:     srv,
   103  		FullMethod: KV_Get_FullMethodName,
   104  	}
   105  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   106  		return srv.(KVServer).Get(ctx, req.(*GetRequest))
   107  	}
   108  	return interceptor(ctx, in, info, handler)
   109  }
   110  
   111  func _KV_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   112  	in := new(PutRequest)
   113  	if err := dec(in); err != nil {
   114  		return nil, err
   115  	}
   116  	if interceptor == nil {
   117  		return srv.(KVServer).Put(ctx, in)
   118  	}
   119  	info := &grpc.UnaryServerInfo{
   120  		Server:     srv,
   121  		FullMethod: KV_Put_FullMethodName,
   122  	}
   123  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   124  		return srv.(KVServer).Put(ctx, req.(*PutRequest))
   125  	}
   126  	return interceptor(ctx, in, info, handler)
   127  }
   128  
   129  // KV_ServiceDesc is the grpc.ServiceDesc for KV service.
   130  // It's only intended for direct use with grpc.RegisterService,
   131  // and not to be introspected or modified (even as a copy)
   132  var KV_ServiceDesc = grpc.ServiceDesc{
   133  	ServiceName: "proto.KV",
   134  	HandlerType: (*KVServer)(nil),
   135  	Methods: []grpc.MethodDesc{
   136  		{
   137  			MethodName: "Get",
   138  			Handler:    _KV_Get_Handler,
   139  		},
   140  		{
   141  			MethodName: "Put",
   142  			Handler:    _KV_Put_Handler,
   143  		},
   144  	},
   145  	Streams:  []grpc.StreamDesc{},
   146  	Metadata: "proto/kv.proto",
   147  }