...

Source file src/cloud.google.com/go/rpcreplay/proto/intstore/intstore_grpc.pb.go

Documentation: cloud.google.com/go/rpcreplay/proto/intstore

     1  // Copyright 2024 Google LLC
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // IntStore is a service for testing the rpcreplay package.
    16  // It is a simple key-value store for integers.
    17  
    18  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
    19  // versions:
    20  // - protoc-gen-go-grpc v1.3.0
    21  // - protoc             v4.25.3
    22  // source: intstore.proto
    23  
    24  package intstore
    25  
    26  import (
    27  	context "context"
    28  
    29  	grpc "google.golang.org/grpc"
    30  	codes "google.golang.org/grpc/codes"
    31  	status "google.golang.org/grpc/status"
    32  )
    33  
    34  // This is a compile-time assertion to ensure that this generated file
    35  // is compatible with the grpc package it is being compiled against.
    36  // Requires gRPC-Go v1.32.0 or later.
    37  const _ = grpc.SupportPackageIsVersion7
    38  
    39  const (
    40  	IntStore_Set_FullMethodName        = "/intstore.IntStore/Set"
    41  	IntStore_Get_FullMethodName        = "/intstore.IntStore/Get"
    42  	IntStore_ListItems_FullMethodName  = "/intstore.IntStore/ListItems"
    43  	IntStore_SetStream_FullMethodName  = "/intstore.IntStore/SetStream"
    44  	IntStore_StreamChat_FullMethodName = "/intstore.IntStore/StreamChat"
    45  )
    46  
    47  // IntStoreClient is the client API for IntStore service.
    48  //
    49  // 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.
    50  type IntStoreClient interface {
    51  	Set(ctx context.Context, in *Item, opts ...grpc.CallOption) (*SetResponse, error)
    52  	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*Item, error)
    53  	// A server-to-client streaming RPC.
    54  	ListItems(ctx context.Context, in *ListItemsRequest, opts ...grpc.CallOption) (IntStore_ListItemsClient, error)
    55  	// A client-to-server streaming RPC.
    56  	SetStream(ctx context.Context, opts ...grpc.CallOption) (IntStore_SetStreamClient, error)
    57  	// A Bidirectional streaming RPC.
    58  	StreamChat(ctx context.Context, opts ...grpc.CallOption) (IntStore_StreamChatClient, error)
    59  }
    60  
    61  type intStoreClient struct {
    62  	cc grpc.ClientConnInterface
    63  }
    64  
    65  func NewIntStoreClient(cc grpc.ClientConnInterface) IntStoreClient {
    66  	return &intStoreClient{cc}
    67  }
    68  
    69  func (c *intStoreClient) Set(ctx context.Context, in *Item, opts ...grpc.CallOption) (*SetResponse, error) {
    70  	out := new(SetResponse)
    71  	err := c.cc.Invoke(ctx, IntStore_Set_FullMethodName, in, out, opts...)
    72  	if err != nil {
    73  		return nil, err
    74  	}
    75  	return out, nil
    76  }
    77  
    78  func (c *intStoreClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*Item, error) {
    79  	out := new(Item)
    80  	err := c.cc.Invoke(ctx, IntStore_Get_FullMethodName, in, out, opts...)
    81  	if err != nil {
    82  		return nil, err
    83  	}
    84  	return out, nil
    85  }
    86  
    87  func (c *intStoreClient) ListItems(ctx context.Context, in *ListItemsRequest, opts ...grpc.CallOption) (IntStore_ListItemsClient, error) {
    88  	stream, err := c.cc.NewStream(ctx, &IntStore_ServiceDesc.Streams[0], IntStore_ListItems_FullMethodName, opts...)
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  	x := &intStoreListItemsClient{stream}
    93  	if err := x.ClientStream.SendMsg(in); err != nil {
    94  		return nil, err
    95  	}
    96  	if err := x.ClientStream.CloseSend(); err != nil {
    97  		return nil, err
    98  	}
    99  	return x, nil
   100  }
   101  
   102  type IntStore_ListItemsClient interface {
   103  	Recv() (*Item, error)
   104  	grpc.ClientStream
   105  }
   106  
   107  type intStoreListItemsClient struct {
   108  	grpc.ClientStream
   109  }
   110  
   111  func (x *intStoreListItemsClient) Recv() (*Item, error) {
   112  	m := new(Item)
   113  	if err := x.ClientStream.RecvMsg(m); err != nil {
   114  		return nil, err
   115  	}
   116  	return m, nil
   117  }
   118  
   119  func (c *intStoreClient) SetStream(ctx context.Context, opts ...grpc.CallOption) (IntStore_SetStreamClient, error) {
   120  	stream, err := c.cc.NewStream(ctx, &IntStore_ServiceDesc.Streams[1], IntStore_SetStream_FullMethodName, opts...)
   121  	if err != nil {
   122  		return nil, err
   123  	}
   124  	x := &intStoreSetStreamClient{stream}
   125  	return x, nil
   126  }
   127  
   128  type IntStore_SetStreamClient interface {
   129  	Send(*Item) error
   130  	CloseAndRecv() (*Summary, error)
   131  	grpc.ClientStream
   132  }
   133  
   134  type intStoreSetStreamClient struct {
   135  	grpc.ClientStream
   136  }
   137  
   138  func (x *intStoreSetStreamClient) Send(m *Item) error {
   139  	return x.ClientStream.SendMsg(m)
   140  }
   141  
   142  func (x *intStoreSetStreamClient) CloseAndRecv() (*Summary, error) {
   143  	if err := x.ClientStream.CloseSend(); err != nil {
   144  		return nil, err
   145  	}
   146  	m := new(Summary)
   147  	if err := x.ClientStream.RecvMsg(m); err != nil {
   148  		return nil, err
   149  	}
   150  	return m, nil
   151  }
   152  
   153  func (c *intStoreClient) StreamChat(ctx context.Context, opts ...grpc.CallOption) (IntStore_StreamChatClient, error) {
   154  	stream, err := c.cc.NewStream(ctx, &IntStore_ServiceDesc.Streams[2], IntStore_StreamChat_FullMethodName, opts...)
   155  	if err != nil {
   156  		return nil, err
   157  	}
   158  	x := &intStoreStreamChatClient{stream}
   159  	return x, nil
   160  }
   161  
   162  type IntStore_StreamChatClient interface {
   163  	Send(*Item) error
   164  	Recv() (*Item, error)
   165  	grpc.ClientStream
   166  }
   167  
   168  type intStoreStreamChatClient struct {
   169  	grpc.ClientStream
   170  }
   171  
   172  func (x *intStoreStreamChatClient) Send(m *Item) error {
   173  	return x.ClientStream.SendMsg(m)
   174  }
   175  
   176  func (x *intStoreStreamChatClient) Recv() (*Item, error) {
   177  	m := new(Item)
   178  	if err := x.ClientStream.RecvMsg(m); err != nil {
   179  		return nil, err
   180  	}
   181  	return m, nil
   182  }
   183  
   184  // IntStoreServer is the server API for IntStore service.
   185  // All implementations must embed UnimplementedIntStoreServer
   186  // for forward compatibility
   187  type IntStoreServer interface {
   188  	Set(context.Context, *Item) (*SetResponse, error)
   189  	Get(context.Context, *GetRequest) (*Item, error)
   190  	// A server-to-client streaming RPC.
   191  	ListItems(*ListItemsRequest, IntStore_ListItemsServer) error
   192  	// A client-to-server streaming RPC.
   193  	SetStream(IntStore_SetStreamServer) error
   194  	// A Bidirectional streaming RPC.
   195  	StreamChat(IntStore_StreamChatServer) error
   196  	mustEmbedUnimplementedIntStoreServer()
   197  }
   198  
   199  // UnimplementedIntStoreServer must be embedded to have forward compatible implementations.
   200  type UnimplementedIntStoreServer struct {
   201  }
   202  
   203  func (UnimplementedIntStoreServer) Set(context.Context, *Item) (*SetResponse, error) {
   204  	return nil, status.Errorf(codes.Unimplemented, "method Set not implemented")
   205  }
   206  func (UnimplementedIntStoreServer) Get(context.Context, *GetRequest) (*Item, error) {
   207  	return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
   208  }
   209  func (UnimplementedIntStoreServer) ListItems(*ListItemsRequest, IntStore_ListItemsServer) error {
   210  	return status.Errorf(codes.Unimplemented, "method ListItems not implemented")
   211  }
   212  func (UnimplementedIntStoreServer) SetStream(IntStore_SetStreamServer) error {
   213  	return status.Errorf(codes.Unimplemented, "method SetStream not implemented")
   214  }
   215  func (UnimplementedIntStoreServer) StreamChat(IntStore_StreamChatServer) error {
   216  	return status.Errorf(codes.Unimplemented, "method StreamChat not implemented")
   217  }
   218  func (UnimplementedIntStoreServer) mustEmbedUnimplementedIntStoreServer() {}
   219  
   220  // UnsafeIntStoreServer may be embedded to opt out of forward compatibility for this service.
   221  // Use of this interface is not recommended, as added methods to IntStoreServer will
   222  // result in compilation errors.
   223  type UnsafeIntStoreServer interface {
   224  	mustEmbedUnimplementedIntStoreServer()
   225  }
   226  
   227  func RegisterIntStoreServer(s grpc.ServiceRegistrar, srv IntStoreServer) {
   228  	s.RegisterService(&IntStore_ServiceDesc, srv)
   229  }
   230  
   231  func _IntStore_Set_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   232  	in := new(Item)
   233  	if err := dec(in); err != nil {
   234  		return nil, err
   235  	}
   236  	if interceptor == nil {
   237  		return srv.(IntStoreServer).Set(ctx, in)
   238  	}
   239  	info := &grpc.UnaryServerInfo{
   240  		Server:     srv,
   241  		FullMethod: IntStore_Set_FullMethodName,
   242  	}
   243  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   244  		return srv.(IntStoreServer).Set(ctx, req.(*Item))
   245  	}
   246  	return interceptor(ctx, in, info, handler)
   247  }
   248  
   249  func _IntStore_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   250  	in := new(GetRequest)
   251  	if err := dec(in); err != nil {
   252  		return nil, err
   253  	}
   254  	if interceptor == nil {
   255  		return srv.(IntStoreServer).Get(ctx, in)
   256  	}
   257  	info := &grpc.UnaryServerInfo{
   258  		Server:     srv,
   259  		FullMethod: IntStore_Get_FullMethodName,
   260  	}
   261  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   262  		return srv.(IntStoreServer).Get(ctx, req.(*GetRequest))
   263  	}
   264  	return interceptor(ctx, in, info, handler)
   265  }
   266  
   267  func _IntStore_ListItems_Handler(srv interface{}, stream grpc.ServerStream) error {
   268  	m := new(ListItemsRequest)
   269  	if err := stream.RecvMsg(m); err != nil {
   270  		return err
   271  	}
   272  	return srv.(IntStoreServer).ListItems(m, &intStoreListItemsServer{stream})
   273  }
   274  
   275  type IntStore_ListItemsServer interface {
   276  	Send(*Item) error
   277  	grpc.ServerStream
   278  }
   279  
   280  type intStoreListItemsServer struct {
   281  	grpc.ServerStream
   282  }
   283  
   284  func (x *intStoreListItemsServer) Send(m *Item) error {
   285  	return x.ServerStream.SendMsg(m)
   286  }
   287  
   288  func _IntStore_SetStream_Handler(srv interface{}, stream grpc.ServerStream) error {
   289  	return srv.(IntStoreServer).SetStream(&intStoreSetStreamServer{stream})
   290  }
   291  
   292  type IntStore_SetStreamServer interface {
   293  	SendAndClose(*Summary) error
   294  	Recv() (*Item, error)
   295  	grpc.ServerStream
   296  }
   297  
   298  type intStoreSetStreamServer struct {
   299  	grpc.ServerStream
   300  }
   301  
   302  func (x *intStoreSetStreamServer) SendAndClose(m *Summary) error {
   303  	return x.ServerStream.SendMsg(m)
   304  }
   305  
   306  func (x *intStoreSetStreamServer) Recv() (*Item, error) {
   307  	m := new(Item)
   308  	if err := x.ServerStream.RecvMsg(m); err != nil {
   309  		return nil, err
   310  	}
   311  	return m, nil
   312  }
   313  
   314  func _IntStore_StreamChat_Handler(srv interface{}, stream grpc.ServerStream) error {
   315  	return srv.(IntStoreServer).StreamChat(&intStoreStreamChatServer{stream})
   316  }
   317  
   318  type IntStore_StreamChatServer interface {
   319  	Send(*Item) error
   320  	Recv() (*Item, error)
   321  	grpc.ServerStream
   322  }
   323  
   324  type intStoreStreamChatServer struct {
   325  	grpc.ServerStream
   326  }
   327  
   328  func (x *intStoreStreamChatServer) Send(m *Item) error {
   329  	return x.ServerStream.SendMsg(m)
   330  }
   331  
   332  func (x *intStoreStreamChatServer) Recv() (*Item, error) {
   333  	m := new(Item)
   334  	if err := x.ServerStream.RecvMsg(m); err != nil {
   335  		return nil, err
   336  	}
   337  	return m, nil
   338  }
   339  
   340  // IntStore_ServiceDesc is the grpc.ServiceDesc for IntStore service.
   341  // It's only intended for direct use with grpc.RegisterService,
   342  // and not to be introspected or modified (even as a copy)
   343  var IntStore_ServiceDesc = grpc.ServiceDesc{
   344  	ServiceName: "intstore.IntStore",
   345  	HandlerType: (*IntStoreServer)(nil),
   346  	Methods: []grpc.MethodDesc{
   347  		{
   348  			MethodName: "Set",
   349  			Handler:    _IntStore_Set_Handler,
   350  		},
   351  		{
   352  			MethodName: "Get",
   353  			Handler:    _IntStore_Get_Handler,
   354  		},
   355  	},
   356  	Streams: []grpc.StreamDesc{
   357  		{
   358  			StreamName:    "ListItems",
   359  			Handler:       _IntStore_ListItems_Handler,
   360  			ServerStreams: true,
   361  		},
   362  		{
   363  			StreamName:    "SetStream",
   364  			Handler:       _IntStore_SetStream_Handler,
   365  			ClientStreams: true,
   366  		},
   367  		{
   368  			StreamName:    "StreamChat",
   369  			Handler:       _IntStore_StreamChat_Handler,
   370  			ServerStreams: true,
   371  			ClientStreams: true,
   372  		},
   373  	},
   374  	Metadata: "intstore.proto",
   375  }
   376  

View as plain text