github.com/ledgerwatch/erigon-lib@v1.0.0/gointerfaces/remote/kv_grpc.pb.go (about)

     1  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
     2  // versions:
     3  // - protoc-gen-go-grpc v1.3.0
     4  // - protoc             v4.24.2
     5  // source: remote/kv.proto
     6  
     7  package remote
     8  
     9  import (
    10  	context "context"
    11  	types "github.com/ledgerwatch/erigon-lib/gointerfaces/types"
    12  	grpc "google.golang.org/grpc"
    13  	codes "google.golang.org/grpc/codes"
    14  	status "google.golang.org/grpc/status"
    15  	emptypb "google.golang.org/protobuf/types/known/emptypb"
    16  )
    17  
    18  // This is a compile-time assertion to ensure that this generated file
    19  // is compatible with the grpc package it is being compiled against.
    20  // Requires gRPC-Go v1.32.0 or later.
    21  const _ = grpc.SupportPackageIsVersion7
    22  
    23  const (
    24  	KV_Version_FullMethodName      = "/remote.KV/Version"
    25  	KV_Tx_FullMethodName           = "/remote.KV/Tx"
    26  	KV_StateChanges_FullMethodName = "/remote.KV/StateChanges"
    27  	KV_Snapshots_FullMethodName    = "/remote.KV/Snapshots"
    28  	KV_Range_FullMethodName        = "/remote.KV/Range"
    29  	KV_DomainGet_FullMethodName    = "/remote.KV/DomainGet"
    30  	KV_HistoryGet_FullMethodName   = "/remote.KV/HistoryGet"
    31  	KV_IndexRange_FullMethodName   = "/remote.KV/IndexRange"
    32  	KV_HistoryRange_FullMethodName = "/remote.KV/HistoryRange"
    33  	KV_DomainRange_FullMethodName  = "/remote.KV/DomainRange"
    34  )
    35  
    36  // KVClient is the client API for KV service.
    37  //
    38  // 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.
    39  type KVClient interface {
    40  	// Version returns the service version number
    41  	Version(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*types.VersionReply, error)
    42  	// Tx exposes read-only transactions for the key-value store
    43  	//
    44  	// When tx open, client must receive 1 message from server with txID
    45  	// When cursor open, client must receive 1 message from server with cursorID
    46  	// Then only client can initiate messages from server
    47  	Tx(ctx context.Context, opts ...grpc.CallOption) (KV_TxClient, error)
    48  	StateChanges(ctx context.Context, in *StateChangeRequest, opts ...grpc.CallOption) (KV_StateChangesClient, error)
    49  	// Snapshots returns list of current snapshot files. Then client can just open all of them.
    50  	Snapshots(ctx context.Context, in *SnapshotsRequest, opts ...grpc.CallOption) (*SnapshotsReply, error)
    51  	// Range [from, to)
    52  	// Range(from, nil) means [from, EndOfTable)
    53  	// Range(nil, to)   means [StartOfTable, to)
    54  	// If orderAscend=false server expecting `from`<`to`. Example: Range("B", "A")
    55  	Range(ctx context.Context, in *RangeReq, opts ...grpc.CallOption) (*Pairs, error)
    56  	// Temporal methods
    57  	DomainGet(ctx context.Context, in *DomainGetReq, opts ...grpc.CallOption) (*DomainGetReply, error)
    58  	HistoryGet(ctx context.Context, in *HistoryGetReq, opts ...grpc.CallOption) (*HistoryGetReply, error)
    59  	IndexRange(ctx context.Context, in *IndexRangeReq, opts ...grpc.CallOption) (*IndexRangeReply, error)
    60  	HistoryRange(ctx context.Context, in *HistoryRangeReq, opts ...grpc.CallOption) (*Pairs, error)
    61  	DomainRange(ctx context.Context, in *DomainRangeReq, opts ...grpc.CallOption) (*Pairs, error)
    62  }
    63  
    64  type kVClient struct {
    65  	cc grpc.ClientConnInterface
    66  }
    67  
    68  func NewKVClient(cc grpc.ClientConnInterface) KVClient {
    69  	return &kVClient{cc}
    70  }
    71  
    72  func (c *kVClient) Version(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*types.VersionReply, error) {
    73  	out := new(types.VersionReply)
    74  	err := c.cc.Invoke(ctx, KV_Version_FullMethodName, in, out, opts...)
    75  	if err != nil {
    76  		return nil, err
    77  	}
    78  	return out, nil
    79  }
    80  
    81  func (c *kVClient) Tx(ctx context.Context, opts ...grpc.CallOption) (KV_TxClient, error) {
    82  	stream, err := c.cc.NewStream(ctx, &KV_ServiceDesc.Streams[0], KV_Tx_FullMethodName, opts...)
    83  	if err != nil {
    84  		return nil, err
    85  	}
    86  	x := &kVTxClient{stream}
    87  	return x, nil
    88  }
    89  
    90  type KV_TxClient interface {
    91  	Send(*Cursor) error
    92  	Recv() (*Pair, error)
    93  	grpc.ClientStream
    94  }
    95  
    96  type kVTxClient struct {
    97  	grpc.ClientStream
    98  }
    99  
   100  func (x *kVTxClient) Send(m *Cursor) error {
   101  	return x.ClientStream.SendMsg(m)
   102  }
   103  
   104  func (x *kVTxClient) Recv() (*Pair, error) {
   105  	m := new(Pair)
   106  	if err := x.ClientStream.RecvMsg(m); err != nil {
   107  		return nil, err
   108  	}
   109  	return m, nil
   110  }
   111  
   112  func (c *kVClient) StateChanges(ctx context.Context, in *StateChangeRequest, opts ...grpc.CallOption) (KV_StateChangesClient, error) {
   113  	stream, err := c.cc.NewStream(ctx, &KV_ServiceDesc.Streams[1], KV_StateChanges_FullMethodName, opts...)
   114  	if err != nil {
   115  		return nil, err
   116  	}
   117  	x := &kVStateChangesClient{stream}
   118  	if err := x.ClientStream.SendMsg(in); err != nil {
   119  		return nil, err
   120  	}
   121  	if err := x.ClientStream.CloseSend(); err != nil {
   122  		return nil, err
   123  	}
   124  	return x, nil
   125  }
   126  
   127  type KV_StateChangesClient interface {
   128  	Recv() (*StateChangeBatch, error)
   129  	grpc.ClientStream
   130  }
   131  
   132  type kVStateChangesClient struct {
   133  	grpc.ClientStream
   134  }
   135  
   136  func (x *kVStateChangesClient) Recv() (*StateChangeBatch, error) {
   137  	m := new(StateChangeBatch)
   138  	if err := x.ClientStream.RecvMsg(m); err != nil {
   139  		return nil, err
   140  	}
   141  	return m, nil
   142  }
   143  
   144  func (c *kVClient) Snapshots(ctx context.Context, in *SnapshotsRequest, opts ...grpc.CallOption) (*SnapshotsReply, error) {
   145  	out := new(SnapshotsReply)
   146  	err := c.cc.Invoke(ctx, KV_Snapshots_FullMethodName, in, out, opts...)
   147  	if err != nil {
   148  		return nil, err
   149  	}
   150  	return out, nil
   151  }
   152  
   153  func (c *kVClient) Range(ctx context.Context, in *RangeReq, opts ...grpc.CallOption) (*Pairs, error) {
   154  	out := new(Pairs)
   155  	err := c.cc.Invoke(ctx, KV_Range_FullMethodName, in, out, opts...)
   156  	if err != nil {
   157  		return nil, err
   158  	}
   159  	return out, nil
   160  }
   161  
   162  func (c *kVClient) DomainGet(ctx context.Context, in *DomainGetReq, opts ...grpc.CallOption) (*DomainGetReply, error) {
   163  	out := new(DomainGetReply)
   164  	err := c.cc.Invoke(ctx, KV_DomainGet_FullMethodName, in, out, opts...)
   165  	if err != nil {
   166  		return nil, err
   167  	}
   168  	return out, nil
   169  }
   170  
   171  func (c *kVClient) HistoryGet(ctx context.Context, in *HistoryGetReq, opts ...grpc.CallOption) (*HistoryGetReply, error) {
   172  	out := new(HistoryGetReply)
   173  	err := c.cc.Invoke(ctx, KV_HistoryGet_FullMethodName, in, out, opts...)
   174  	if err != nil {
   175  		return nil, err
   176  	}
   177  	return out, nil
   178  }
   179  
   180  func (c *kVClient) IndexRange(ctx context.Context, in *IndexRangeReq, opts ...grpc.CallOption) (*IndexRangeReply, error) {
   181  	out := new(IndexRangeReply)
   182  	err := c.cc.Invoke(ctx, KV_IndexRange_FullMethodName, in, out, opts...)
   183  	if err != nil {
   184  		return nil, err
   185  	}
   186  	return out, nil
   187  }
   188  
   189  func (c *kVClient) HistoryRange(ctx context.Context, in *HistoryRangeReq, opts ...grpc.CallOption) (*Pairs, error) {
   190  	out := new(Pairs)
   191  	err := c.cc.Invoke(ctx, KV_HistoryRange_FullMethodName, in, out, opts...)
   192  	if err != nil {
   193  		return nil, err
   194  	}
   195  	return out, nil
   196  }
   197  
   198  func (c *kVClient) DomainRange(ctx context.Context, in *DomainRangeReq, opts ...grpc.CallOption) (*Pairs, error) {
   199  	out := new(Pairs)
   200  	err := c.cc.Invoke(ctx, KV_DomainRange_FullMethodName, in, out, opts...)
   201  	if err != nil {
   202  		return nil, err
   203  	}
   204  	return out, nil
   205  }
   206  
   207  // KVServer is the server API for KV service.
   208  // All implementations must embed UnimplementedKVServer
   209  // for forward compatibility
   210  type KVServer interface {
   211  	// Version returns the service version number
   212  	Version(context.Context, *emptypb.Empty) (*types.VersionReply, error)
   213  	// Tx exposes read-only transactions for the key-value store
   214  	//
   215  	// When tx open, client must receive 1 message from server with txID
   216  	// When cursor open, client must receive 1 message from server with cursorID
   217  	// Then only client can initiate messages from server
   218  	Tx(KV_TxServer) error
   219  	StateChanges(*StateChangeRequest, KV_StateChangesServer) error
   220  	// Snapshots returns list of current snapshot files. Then client can just open all of them.
   221  	Snapshots(context.Context, *SnapshotsRequest) (*SnapshotsReply, error)
   222  	// Range [from, to)
   223  	// Range(from, nil) means [from, EndOfTable)
   224  	// Range(nil, to)   means [StartOfTable, to)
   225  	// If orderAscend=false server expecting `from`<`to`. Example: Range("B", "A")
   226  	Range(context.Context, *RangeReq) (*Pairs, error)
   227  	// Temporal methods
   228  	DomainGet(context.Context, *DomainGetReq) (*DomainGetReply, error)
   229  	HistoryGet(context.Context, *HistoryGetReq) (*HistoryGetReply, error)
   230  	IndexRange(context.Context, *IndexRangeReq) (*IndexRangeReply, error)
   231  	HistoryRange(context.Context, *HistoryRangeReq) (*Pairs, error)
   232  	DomainRange(context.Context, *DomainRangeReq) (*Pairs, error)
   233  	mustEmbedUnimplementedKVServer()
   234  }
   235  
   236  // UnimplementedKVServer must be embedded to have forward compatible implementations.
   237  type UnimplementedKVServer struct {
   238  }
   239  
   240  func (UnimplementedKVServer) Version(context.Context, *emptypb.Empty) (*types.VersionReply, error) {
   241  	return nil, status.Errorf(codes.Unimplemented, "method Version not implemented")
   242  }
   243  func (UnimplementedKVServer) Tx(KV_TxServer) error {
   244  	return status.Errorf(codes.Unimplemented, "method Tx not implemented")
   245  }
   246  func (UnimplementedKVServer) StateChanges(*StateChangeRequest, KV_StateChangesServer) error {
   247  	return status.Errorf(codes.Unimplemented, "method StateChanges not implemented")
   248  }
   249  func (UnimplementedKVServer) Snapshots(context.Context, *SnapshotsRequest) (*SnapshotsReply, error) {
   250  	return nil, status.Errorf(codes.Unimplemented, "method Snapshots not implemented")
   251  }
   252  func (UnimplementedKVServer) Range(context.Context, *RangeReq) (*Pairs, error) {
   253  	return nil, status.Errorf(codes.Unimplemented, "method Range not implemented")
   254  }
   255  func (UnimplementedKVServer) DomainGet(context.Context, *DomainGetReq) (*DomainGetReply, error) {
   256  	return nil, status.Errorf(codes.Unimplemented, "method DomainGet not implemented")
   257  }
   258  func (UnimplementedKVServer) HistoryGet(context.Context, *HistoryGetReq) (*HistoryGetReply, error) {
   259  	return nil, status.Errorf(codes.Unimplemented, "method HistoryGet not implemented")
   260  }
   261  func (UnimplementedKVServer) IndexRange(context.Context, *IndexRangeReq) (*IndexRangeReply, error) {
   262  	return nil, status.Errorf(codes.Unimplemented, "method IndexRange not implemented")
   263  }
   264  func (UnimplementedKVServer) HistoryRange(context.Context, *HistoryRangeReq) (*Pairs, error) {
   265  	return nil, status.Errorf(codes.Unimplemented, "method HistoryRange not implemented")
   266  }
   267  func (UnimplementedKVServer) DomainRange(context.Context, *DomainRangeReq) (*Pairs, error) {
   268  	return nil, status.Errorf(codes.Unimplemented, "method DomainRange not implemented")
   269  }
   270  func (UnimplementedKVServer) mustEmbedUnimplementedKVServer() {}
   271  
   272  // UnsafeKVServer may be embedded to opt out of forward compatibility for this service.
   273  // Use of this interface is not recommended, as added methods to KVServer will
   274  // result in compilation errors.
   275  type UnsafeKVServer interface {
   276  	mustEmbedUnimplementedKVServer()
   277  }
   278  
   279  func RegisterKVServer(s grpc.ServiceRegistrar, srv KVServer) {
   280  	s.RegisterService(&KV_ServiceDesc, srv)
   281  }
   282  
   283  func _KV_Version_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   284  	in := new(emptypb.Empty)
   285  	if err := dec(in); err != nil {
   286  		return nil, err
   287  	}
   288  	if interceptor == nil {
   289  		return srv.(KVServer).Version(ctx, in)
   290  	}
   291  	info := &grpc.UnaryServerInfo{
   292  		Server:     srv,
   293  		FullMethod: KV_Version_FullMethodName,
   294  	}
   295  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   296  		return srv.(KVServer).Version(ctx, req.(*emptypb.Empty))
   297  	}
   298  	return interceptor(ctx, in, info, handler)
   299  }
   300  
   301  func _KV_Tx_Handler(srv interface{}, stream grpc.ServerStream) error {
   302  	return srv.(KVServer).Tx(&kVTxServer{stream})
   303  }
   304  
   305  type KV_TxServer interface {
   306  	Send(*Pair) error
   307  	Recv() (*Cursor, error)
   308  	grpc.ServerStream
   309  }
   310  
   311  type kVTxServer struct {
   312  	grpc.ServerStream
   313  }
   314  
   315  func (x *kVTxServer) Send(m *Pair) error {
   316  	return x.ServerStream.SendMsg(m)
   317  }
   318  
   319  func (x *kVTxServer) Recv() (*Cursor, error) {
   320  	m := new(Cursor)
   321  	if err := x.ServerStream.RecvMsg(m); err != nil {
   322  		return nil, err
   323  	}
   324  	return m, nil
   325  }
   326  
   327  func _KV_StateChanges_Handler(srv interface{}, stream grpc.ServerStream) error {
   328  	m := new(StateChangeRequest)
   329  	if err := stream.RecvMsg(m); err != nil {
   330  		return err
   331  	}
   332  	return srv.(KVServer).StateChanges(m, &kVStateChangesServer{stream})
   333  }
   334  
   335  type KV_StateChangesServer interface {
   336  	Send(*StateChangeBatch) error
   337  	grpc.ServerStream
   338  }
   339  
   340  type kVStateChangesServer struct {
   341  	grpc.ServerStream
   342  }
   343  
   344  func (x *kVStateChangesServer) Send(m *StateChangeBatch) error {
   345  	return x.ServerStream.SendMsg(m)
   346  }
   347  
   348  func _KV_Snapshots_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   349  	in := new(SnapshotsRequest)
   350  	if err := dec(in); err != nil {
   351  		return nil, err
   352  	}
   353  	if interceptor == nil {
   354  		return srv.(KVServer).Snapshots(ctx, in)
   355  	}
   356  	info := &grpc.UnaryServerInfo{
   357  		Server:     srv,
   358  		FullMethod: KV_Snapshots_FullMethodName,
   359  	}
   360  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   361  		return srv.(KVServer).Snapshots(ctx, req.(*SnapshotsRequest))
   362  	}
   363  	return interceptor(ctx, in, info, handler)
   364  }
   365  
   366  func _KV_Range_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   367  	in := new(RangeReq)
   368  	if err := dec(in); err != nil {
   369  		return nil, err
   370  	}
   371  	if interceptor == nil {
   372  		return srv.(KVServer).Range(ctx, in)
   373  	}
   374  	info := &grpc.UnaryServerInfo{
   375  		Server:     srv,
   376  		FullMethod: KV_Range_FullMethodName,
   377  	}
   378  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   379  		return srv.(KVServer).Range(ctx, req.(*RangeReq))
   380  	}
   381  	return interceptor(ctx, in, info, handler)
   382  }
   383  
   384  func _KV_DomainGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   385  	in := new(DomainGetReq)
   386  	if err := dec(in); err != nil {
   387  		return nil, err
   388  	}
   389  	if interceptor == nil {
   390  		return srv.(KVServer).DomainGet(ctx, in)
   391  	}
   392  	info := &grpc.UnaryServerInfo{
   393  		Server:     srv,
   394  		FullMethod: KV_DomainGet_FullMethodName,
   395  	}
   396  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   397  		return srv.(KVServer).DomainGet(ctx, req.(*DomainGetReq))
   398  	}
   399  	return interceptor(ctx, in, info, handler)
   400  }
   401  
   402  func _KV_HistoryGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   403  	in := new(HistoryGetReq)
   404  	if err := dec(in); err != nil {
   405  		return nil, err
   406  	}
   407  	if interceptor == nil {
   408  		return srv.(KVServer).HistoryGet(ctx, in)
   409  	}
   410  	info := &grpc.UnaryServerInfo{
   411  		Server:     srv,
   412  		FullMethod: KV_HistoryGet_FullMethodName,
   413  	}
   414  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   415  		return srv.(KVServer).HistoryGet(ctx, req.(*HistoryGetReq))
   416  	}
   417  	return interceptor(ctx, in, info, handler)
   418  }
   419  
   420  func _KV_IndexRange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   421  	in := new(IndexRangeReq)
   422  	if err := dec(in); err != nil {
   423  		return nil, err
   424  	}
   425  	if interceptor == nil {
   426  		return srv.(KVServer).IndexRange(ctx, in)
   427  	}
   428  	info := &grpc.UnaryServerInfo{
   429  		Server:     srv,
   430  		FullMethod: KV_IndexRange_FullMethodName,
   431  	}
   432  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   433  		return srv.(KVServer).IndexRange(ctx, req.(*IndexRangeReq))
   434  	}
   435  	return interceptor(ctx, in, info, handler)
   436  }
   437  
   438  func _KV_HistoryRange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   439  	in := new(HistoryRangeReq)
   440  	if err := dec(in); err != nil {
   441  		return nil, err
   442  	}
   443  	if interceptor == nil {
   444  		return srv.(KVServer).HistoryRange(ctx, in)
   445  	}
   446  	info := &grpc.UnaryServerInfo{
   447  		Server:     srv,
   448  		FullMethod: KV_HistoryRange_FullMethodName,
   449  	}
   450  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   451  		return srv.(KVServer).HistoryRange(ctx, req.(*HistoryRangeReq))
   452  	}
   453  	return interceptor(ctx, in, info, handler)
   454  }
   455  
   456  func _KV_DomainRange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   457  	in := new(DomainRangeReq)
   458  	if err := dec(in); err != nil {
   459  		return nil, err
   460  	}
   461  	if interceptor == nil {
   462  		return srv.(KVServer).DomainRange(ctx, in)
   463  	}
   464  	info := &grpc.UnaryServerInfo{
   465  		Server:     srv,
   466  		FullMethod: KV_DomainRange_FullMethodName,
   467  	}
   468  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   469  		return srv.(KVServer).DomainRange(ctx, req.(*DomainRangeReq))
   470  	}
   471  	return interceptor(ctx, in, info, handler)
   472  }
   473  
   474  // KV_ServiceDesc is the grpc.ServiceDesc for KV service.
   475  // It's only intended for direct use with grpc.RegisterService,
   476  // and not to be introspected or modified (even as a copy)
   477  var KV_ServiceDesc = grpc.ServiceDesc{
   478  	ServiceName: "remote.KV",
   479  	HandlerType: (*KVServer)(nil),
   480  	Methods: []grpc.MethodDesc{
   481  		{
   482  			MethodName: "Version",
   483  			Handler:    _KV_Version_Handler,
   484  		},
   485  		{
   486  			MethodName: "Snapshots",
   487  			Handler:    _KV_Snapshots_Handler,
   488  		},
   489  		{
   490  			MethodName: "Range",
   491  			Handler:    _KV_Range_Handler,
   492  		},
   493  		{
   494  			MethodName: "DomainGet",
   495  			Handler:    _KV_DomainGet_Handler,
   496  		},
   497  		{
   498  			MethodName: "HistoryGet",
   499  			Handler:    _KV_HistoryGet_Handler,
   500  		},
   501  		{
   502  			MethodName: "IndexRange",
   503  			Handler:    _KV_IndexRange_Handler,
   504  		},
   505  		{
   506  			MethodName: "HistoryRange",
   507  			Handler:    _KV_HistoryRange_Handler,
   508  		},
   509  		{
   510  			MethodName: "DomainRange",
   511  			Handler:    _KV_DomainRange_Handler,
   512  		},
   513  	},
   514  	Streams: []grpc.StreamDesc{
   515  		{
   516  			StreamName:    "Tx",
   517  			Handler:       _KV_Tx_Handler,
   518  			ServerStreams: true,
   519  			ClientStreams: true,
   520  		},
   521  		{
   522  			StreamName:    "StateChanges",
   523  			Handler:       _KV_StateChanges_Handler,
   524  			ServerStreams: true,
   525  		},
   526  	},
   527  	Metadata: "remote/kv.proto",
   528  }