github.com/ledgerwatch/erigon-lib@v1.0.0/gointerfaces/sentinel/sentinel_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: p2psentinel/sentinel.proto
     6  
     7  package sentinel
     8  
     9  import (
    10  	context "context"
    11  	grpc "google.golang.org/grpc"
    12  	codes "google.golang.org/grpc/codes"
    13  	status "google.golang.org/grpc/status"
    14  )
    15  
    16  // This is a compile-time assertion to ensure that this generated file
    17  // is compatible with the grpc package it is being compiled against.
    18  // Requires gRPC-Go v1.32.0 or later.
    19  const _ = grpc.SupportPackageIsVersion7
    20  
    21  const (
    22  	Sentinel_SubscribeGossip_FullMethodName = "/sentinel.Sentinel/SubscribeGossip"
    23  	Sentinel_SendRequest_FullMethodName     = "/sentinel.Sentinel/SendRequest"
    24  	Sentinel_SetStatus_FullMethodName       = "/sentinel.Sentinel/SetStatus"
    25  	Sentinel_GetPeers_FullMethodName        = "/sentinel.Sentinel/GetPeers"
    26  	Sentinel_BanPeer_FullMethodName         = "/sentinel.Sentinel/BanPeer"
    27  	Sentinel_UnbanPeer_FullMethodName       = "/sentinel.Sentinel/UnbanPeer"
    28  	Sentinel_PenalizePeer_FullMethodName    = "/sentinel.Sentinel/PenalizePeer"
    29  	Sentinel_RewardPeer_FullMethodName      = "/sentinel.Sentinel/RewardPeer"
    30  	Sentinel_PublishGossip_FullMethodName   = "/sentinel.Sentinel/PublishGossip"
    31  )
    32  
    33  // SentinelClient is the client API for Sentinel service.
    34  //
    35  // 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.
    36  type SentinelClient interface {
    37  	SubscribeGossip(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (Sentinel_SubscribeGossipClient, error)
    38  	SendRequest(ctx context.Context, in *RequestData, opts ...grpc.CallOption) (*ResponseData, error)
    39  	SetStatus(ctx context.Context, in *Status, opts ...grpc.CallOption) (*EmptyMessage, error)
    40  	GetPeers(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*PeerCount, error)
    41  	BanPeer(ctx context.Context, in *Peer, opts ...grpc.CallOption) (*EmptyMessage, error)
    42  	UnbanPeer(ctx context.Context, in *Peer, opts ...grpc.CallOption) (*EmptyMessage, error)
    43  	PenalizePeer(ctx context.Context, in *Peer, opts ...grpc.CallOption) (*EmptyMessage, error)
    44  	RewardPeer(ctx context.Context, in *Peer, opts ...grpc.CallOption) (*EmptyMessage, error)
    45  	PublishGossip(ctx context.Context, in *GossipData, opts ...grpc.CallOption) (*EmptyMessage, error)
    46  }
    47  
    48  type sentinelClient struct {
    49  	cc grpc.ClientConnInterface
    50  }
    51  
    52  func NewSentinelClient(cc grpc.ClientConnInterface) SentinelClient {
    53  	return &sentinelClient{cc}
    54  }
    55  
    56  func (c *sentinelClient) SubscribeGossip(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (Sentinel_SubscribeGossipClient, error) {
    57  	stream, err := c.cc.NewStream(ctx, &Sentinel_ServiceDesc.Streams[0], Sentinel_SubscribeGossip_FullMethodName, opts...)
    58  	if err != nil {
    59  		return nil, err
    60  	}
    61  	x := &sentinelSubscribeGossipClient{stream}
    62  	if err := x.ClientStream.SendMsg(in); err != nil {
    63  		return nil, err
    64  	}
    65  	if err := x.ClientStream.CloseSend(); err != nil {
    66  		return nil, err
    67  	}
    68  	return x, nil
    69  }
    70  
    71  type Sentinel_SubscribeGossipClient interface {
    72  	Recv() (*GossipData, error)
    73  	grpc.ClientStream
    74  }
    75  
    76  type sentinelSubscribeGossipClient struct {
    77  	grpc.ClientStream
    78  }
    79  
    80  func (x *sentinelSubscribeGossipClient) Recv() (*GossipData, error) {
    81  	m := new(GossipData)
    82  	if err := x.ClientStream.RecvMsg(m); err != nil {
    83  		return nil, err
    84  	}
    85  	return m, nil
    86  }
    87  
    88  func (c *sentinelClient) SendRequest(ctx context.Context, in *RequestData, opts ...grpc.CallOption) (*ResponseData, error) {
    89  	out := new(ResponseData)
    90  	err := c.cc.Invoke(ctx, Sentinel_SendRequest_FullMethodName, in, out, opts...)
    91  	if err != nil {
    92  		return nil, err
    93  	}
    94  	return out, nil
    95  }
    96  
    97  func (c *sentinelClient) SetStatus(ctx context.Context, in *Status, opts ...grpc.CallOption) (*EmptyMessage, error) {
    98  	out := new(EmptyMessage)
    99  	err := c.cc.Invoke(ctx, Sentinel_SetStatus_FullMethodName, in, out, opts...)
   100  	if err != nil {
   101  		return nil, err
   102  	}
   103  	return out, nil
   104  }
   105  
   106  func (c *sentinelClient) GetPeers(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*PeerCount, error) {
   107  	out := new(PeerCount)
   108  	err := c.cc.Invoke(ctx, Sentinel_GetPeers_FullMethodName, in, out, opts...)
   109  	if err != nil {
   110  		return nil, err
   111  	}
   112  	return out, nil
   113  }
   114  
   115  func (c *sentinelClient) BanPeer(ctx context.Context, in *Peer, opts ...grpc.CallOption) (*EmptyMessage, error) {
   116  	out := new(EmptyMessage)
   117  	err := c.cc.Invoke(ctx, Sentinel_BanPeer_FullMethodName, in, out, opts...)
   118  	if err != nil {
   119  		return nil, err
   120  	}
   121  	return out, nil
   122  }
   123  
   124  func (c *sentinelClient) UnbanPeer(ctx context.Context, in *Peer, opts ...grpc.CallOption) (*EmptyMessage, error) {
   125  	out := new(EmptyMessage)
   126  	err := c.cc.Invoke(ctx, Sentinel_UnbanPeer_FullMethodName, in, out, opts...)
   127  	if err != nil {
   128  		return nil, err
   129  	}
   130  	return out, nil
   131  }
   132  
   133  func (c *sentinelClient) PenalizePeer(ctx context.Context, in *Peer, opts ...grpc.CallOption) (*EmptyMessage, error) {
   134  	out := new(EmptyMessage)
   135  	err := c.cc.Invoke(ctx, Sentinel_PenalizePeer_FullMethodName, in, out, opts...)
   136  	if err != nil {
   137  		return nil, err
   138  	}
   139  	return out, nil
   140  }
   141  
   142  func (c *sentinelClient) RewardPeer(ctx context.Context, in *Peer, opts ...grpc.CallOption) (*EmptyMessage, error) {
   143  	out := new(EmptyMessage)
   144  	err := c.cc.Invoke(ctx, Sentinel_RewardPeer_FullMethodName, in, out, opts...)
   145  	if err != nil {
   146  		return nil, err
   147  	}
   148  	return out, nil
   149  }
   150  
   151  func (c *sentinelClient) PublishGossip(ctx context.Context, in *GossipData, opts ...grpc.CallOption) (*EmptyMessage, error) {
   152  	out := new(EmptyMessage)
   153  	err := c.cc.Invoke(ctx, Sentinel_PublishGossip_FullMethodName, in, out, opts...)
   154  	if err != nil {
   155  		return nil, err
   156  	}
   157  	return out, nil
   158  }
   159  
   160  // SentinelServer is the server API for Sentinel service.
   161  // All implementations must embed UnimplementedSentinelServer
   162  // for forward compatibility
   163  type SentinelServer interface {
   164  	SubscribeGossip(*EmptyMessage, Sentinel_SubscribeGossipServer) error
   165  	SendRequest(context.Context, *RequestData) (*ResponseData, error)
   166  	SetStatus(context.Context, *Status) (*EmptyMessage, error)
   167  	GetPeers(context.Context, *EmptyMessage) (*PeerCount, error)
   168  	BanPeer(context.Context, *Peer) (*EmptyMessage, error)
   169  	UnbanPeer(context.Context, *Peer) (*EmptyMessage, error)
   170  	PenalizePeer(context.Context, *Peer) (*EmptyMessage, error)
   171  	RewardPeer(context.Context, *Peer) (*EmptyMessage, error)
   172  	PublishGossip(context.Context, *GossipData) (*EmptyMessage, error)
   173  	mustEmbedUnimplementedSentinelServer()
   174  }
   175  
   176  // UnimplementedSentinelServer must be embedded to have forward compatible implementations.
   177  type UnimplementedSentinelServer struct {
   178  }
   179  
   180  func (UnimplementedSentinelServer) SubscribeGossip(*EmptyMessage, Sentinel_SubscribeGossipServer) error {
   181  	return status.Errorf(codes.Unimplemented, "method SubscribeGossip not implemented")
   182  }
   183  func (UnimplementedSentinelServer) SendRequest(context.Context, *RequestData) (*ResponseData, error) {
   184  	return nil, status.Errorf(codes.Unimplemented, "method SendRequest not implemented")
   185  }
   186  func (UnimplementedSentinelServer) SetStatus(context.Context, *Status) (*EmptyMessage, error) {
   187  	return nil, status.Errorf(codes.Unimplemented, "method SetStatus not implemented")
   188  }
   189  func (UnimplementedSentinelServer) GetPeers(context.Context, *EmptyMessage) (*PeerCount, error) {
   190  	return nil, status.Errorf(codes.Unimplemented, "method GetPeers not implemented")
   191  }
   192  func (UnimplementedSentinelServer) BanPeer(context.Context, *Peer) (*EmptyMessage, error) {
   193  	return nil, status.Errorf(codes.Unimplemented, "method BanPeer not implemented")
   194  }
   195  func (UnimplementedSentinelServer) UnbanPeer(context.Context, *Peer) (*EmptyMessage, error) {
   196  	return nil, status.Errorf(codes.Unimplemented, "method UnbanPeer not implemented")
   197  }
   198  func (UnimplementedSentinelServer) PenalizePeer(context.Context, *Peer) (*EmptyMessage, error) {
   199  	return nil, status.Errorf(codes.Unimplemented, "method PenalizePeer not implemented")
   200  }
   201  func (UnimplementedSentinelServer) RewardPeer(context.Context, *Peer) (*EmptyMessage, error) {
   202  	return nil, status.Errorf(codes.Unimplemented, "method RewardPeer not implemented")
   203  }
   204  func (UnimplementedSentinelServer) PublishGossip(context.Context, *GossipData) (*EmptyMessage, error) {
   205  	return nil, status.Errorf(codes.Unimplemented, "method PublishGossip not implemented")
   206  }
   207  func (UnimplementedSentinelServer) mustEmbedUnimplementedSentinelServer() {}
   208  
   209  // UnsafeSentinelServer may be embedded to opt out of forward compatibility for this service.
   210  // Use of this interface is not recommended, as added methods to SentinelServer will
   211  // result in compilation errors.
   212  type UnsafeSentinelServer interface {
   213  	mustEmbedUnimplementedSentinelServer()
   214  }
   215  
   216  func RegisterSentinelServer(s grpc.ServiceRegistrar, srv SentinelServer) {
   217  	s.RegisterService(&Sentinel_ServiceDesc, srv)
   218  }
   219  
   220  func _Sentinel_SubscribeGossip_Handler(srv interface{}, stream grpc.ServerStream) error {
   221  	m := new(EmptyMessage)
   222  	if err := stream.RecvMsg(m); err != nil {
   223  		return err
   224  	}
   225  	return srv.(SentinelServer).SubscribeGossip(m, &sentinelSubscribeGossipServer{stream})
   226  }
   227  
   228  type Sentinel_SubscribeGossipServer interface {
   229  	Send(*GossipData) error
   230  	grpc.ServerStream
   231  }
   232  
   233  type sentinelSubscribeGossipServer struct {
   234  	grpc.ServerStream
   235  }
   236  
   237  func (x *sentinelSubscribeGossipServer) Send(m *GossipData) error {
   238  	return x.ServerStream.SendMsg(m)
   239  }
   240  
   241  func _Sentinel_SendRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   242  	in := new(RequestData)
   243  	if err := dec(in); err != nil {
   244  		return nil, err
   245  	}
   246  	if interceptor == nil {
   247  		return srv.(SentinelServer).SendRequest(ctx, in)
   248  	}
   249  	info := &grpc.UnaryServerInfo{
   250  		Server:     srv,
   251  		FullMethod: Sentinel_SendRequest_FullMethodName,
   252  	}
   253  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   254  		return srv.(SentinelServer).SendRequest(ctx, req.(*RequestData))
   255  	}
   256  	return interceptor(ctx, in, info, handler)
   257  }
   258  
   259  func _Sentinel_SetStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   260  	in := new(Status)
   261  	if err := dec(in); err != nil {
   262  		return nil, err
   263  	}
   264  	if interceptor == nil {
   265  		return srv.(SentinelServer).SetStatus(ctx, in)
   266  	}
   267  	info := &grpc.UnaryServerInfo{
   268  		Server:     srv,
   269  		FullMethod: Sentinel_SetStatus_FullMethodName,
   270  	}
   271  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   272  		return srv.(SentinelServer).SetStatus(ctx, req.(*Status))
   273  	}
   274  	return interceptor(ctx, in, info, handler)
   275  }
   276  
   277  func _Sentinel_GetPeers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   278  	in := new(EmptyMessage)
   279  	if err := dec(in); err != nil {
   280  		return nil, err
   281  	}
   282  	if interceptor == nil {
   283  		return srv.(SentinelServer).GetPeers(ctx, in)
   284  	}
   285  	info := &grpc.UnaryServerInfo{
   286  		Server:     srv,
   287  		FullMethod: Sentinel_GetPeers_FullMethodName,
   288  	}
   289  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   290  		return srv.(SentinelServer).GetPeers(ctx, req.(*EmptyMessage))
   291  	}
   292  	return interceptor(ctx, in, info, handler)
   293  }
   294  
   295  func _Sentinel_BanPeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   296  	in := new(Peer)
   297  	if err := dec(in); err != nil {
   298  		return nil, err
   299  	}
   300  	if interceptor == nil {
   301  		return srv.(SentinelServer).BanPeer(ctx, in)
   302  	}
   303  	info := &grpc.UnaryServerInfo{
   304  		Server:     srv,
   305  		FullMethod: Sentinel_BanPeer_FullMethodName,
   306  	}
   307  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   308  		return srv.(SentinelServer).BanPeer(ctx, req.(*Peer))
   309  	}
   310  	return interceptor(ctx, in, info, handler)
   311  }
   312  
   313  func _Sentinel_UnbanPeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   314  	in := new(Peer)
   315  	if err := dec(in); err != nil {
   316  		return nil, err
   317  	}
   318  	if interceptor == nil {
   319  		return srv.(SentinelServer).UnbanPeer(ctx, in)
   320  	}
   321  	info := &grpc.UnaryServerInfo{
   322  		Server:     srv,
   323  		FullMethod: Sentinel_UnbanPeer_FullMethodName,
   324  	}
   325  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   326  		return srv.(SentinelServer).UnbanPeer(ctx, req.(*Peer))
   327  	}
   328  	return interceptor(ctx, in, info, handler)
   329  }
   330  
   331  func _Sentinel_PenalizePeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   332  	in := new(Peer)
   333  	if err := dec(in); err != nil {
   334  		return nil, err
   335  	}
   336  	if interceptor == nil {
   337  		return srv.(SentinelServer).PenalizePeer(ctx, in)
   338  	}
   339  	info := &grpc.UnaryServerInfo{
   340  		Server:     srv,
   341  		FullMethod: Sentinel_PenalizePeer_FullMethodName,
   342  	}
   343  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   344  		return srv.(SentinelServer).PenalizePeer(ctx, req.(*Peer))
   345  	}
   346  	return interceptor(ctx, in, info, handler)
   347  }
   348  
   349  func _Sentinel_RewardPeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   350  	in := new(Peer)
   351  	if err := dec(in); err != nil {
   352  		return nil, err
   353  	}
   354  	if interceptor == nil {
   355  		return srv.(SentinelServer).RewardPeer(ctx, in)
   356  	}
   357  	info := &grpc.UnaryServerInfo{
   358  		Server:     srv,
   359  		FullMethod: Sentinel_RewardPeer_FullMethodName,
   360  	}
   361  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   362  		return srv.(SentinelServer).RewardPeer(ctx, req.(*Peer))
   363  	}
   364  	return interceptor(ctx, in, info, handler)
   365  }
   366  
   367  func _Sentinel_PublishGossip_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   368  	in := new(GossipData)
   369  	if err := dec(in); err != nil {
   370  		return nil, err
   371  	}
   372  	if interceptor == nil {
   373  		return srv.(SentinelServer).PublishGossip(ctx, in)
   374  	}
   375  	info := &grpc.UnaryServerInfo{
   376  		Server:     srv,
   377  		FullMethod: Sentinel_PublishGossip_FullMethodName,
   378  	}
   379  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   380  		return srv.(SentinelServer).PublishGossip(ctx, req.(*GossipData))
   381  	}
   382  	return interceptor(ctx, in, info, handler)
   383  }
   384  
   385  // Sentinel_ServiceDesc is the grpc.ServiceDesc for Sentinel service.
   386  // It's only intended for direct use with grpc.RegisterService,
   387  // and not to be introspected or modified (even as a copy)
   388  var Sentinel_ServiceDesc = grpc.ServiceDesc{
   389  	ServiceName: "sentinel.Sentinel",
   390  	HandlerType: (*SentinelServer)(nil),
   391  	Methods: []grpc.MethodDesc{
   392  		{
   393  			MethodName: "SendRequest",
   394  			Handler:    _Sentinel_SendRequest_Handler,
   395  		},
   396  		{
   397  			MethodName: "SetStatus",
   398  			Handler:    _Sentinel_SetStatus_Handler,
   399  		},
   400  		{
   401  			MethodName: "GetPeers",
   402  			Handler:    _Sentinel_GetPeers_Handler,
   403  		},
   404  		{
   405  			MethodName: "BanPeer",
   406  			Handler:    _Sentinel_BanPeer_Handler,
   407  		},
   408  		{
   409  			MethodName: "UnbanPeer",
   410  			Handler:    _Sentinel_UnbanPeer_Handler,
   411  		},
   412  		{
   413  			MethodName: "PenalizePeer",
   414  			Handler:    _Sentinel_PenalizePeer_Handler,
   415  		},
   416  		{
   417  			MethodName: "RewardPeer",
   418  			Handler:    _Sentinel_RewardPeer_Handler,
   419  		},
   420  		{
   421  			MethodName: "PublishGossip",
   422  			Handler:    _Sentinel_PublishGossip_Handler,
   423  		},
   424  	},
   425  	Streams: []grpc.StreamDesc{
   426  		{
   427  			StreamName:    "SubscribeGossip",
   428  			Handler:       _Sentinel_SubscribeGossip_Handler,
   429  			ServerStreams: true,
   430  		},
   431  	},
   432  	Metadata: "p2psentinel/sentinel.proto",
   433  }