github.com/cilium/cilium@v1.16.2/api/v1/peer/peer_grpc.pb.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright Authors of Hubble 3 4 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 5 // versions: 6 // - protoc-gen-go-grpc v1.3.0 7 // - protoc v5.28.1 8 // source: peer/peer.proto 9 10 package peer 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.62.0 or later. 22 const _ = grpc.SupportPackageIsVersion8 23 24 const ( 25 Peer_Notify_FullMethodName = "/peer.Peer/Notify" 26 ) 27 28 // PeerClient is the client API for Peer service. 29 // 30 // 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. 31 // 32 // Peer lists hubble peers and notifies of changes. 33 type PeerClient interface { 34 // Notify sends information about hubble peers in the cluster. 35 // When Notify is called, it sends information about all the peers that are 36 // already part of the cluster (with the type as PEER_ADDED). It 37 // subsequently notifies of any change. 38 Notify(ctx context.Context, in *NotifyRequest, opts ...grpc.CallOption) (Peer_NotifyClient, error) 39 } 40 41 type peerClient struct { 42 cc grpc.ClientConnInterface 43 } 44 45 func NewPeerClient(cc grpc.ClientConnInterface) PeerClient { 46 return &peerClient{cc} 47 } 48 49 func (c *peerClient) Notify(ctx context.Context, in *NotifyRequest, opts ...grpc.CallOption) (Peer_NotifyClient, error) { 50 cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 51 stream, err := c.cc.NewStream(ctx, &Peer_ServiceDesc.Streams[0], Peer_Notify_FullMethodName, cOpts...) 52 if err != nil { 53 return nil, err 54 } 55 x := &peerNotifyClient{ClientStream: stream} 56 if err := x.ClientStream.SendMsg(in); err != nil { 57 return nil, err 58 } 59 if err := x.ClientStream.CloseSend(); err != nil { 60 return nil, err 61 } 62 return x, nil 63 } 64 65 type Peer_NotifyClient interface { 66 Recv() (*ChangeNotification, error) 67 grpc.ClientStream 68 } 69 70 type peerNotifyClient struct { 71 grpc.ClientStream 72 } 73 74 func (x *peerNotifyClient) Recv() (*ChangeNotification, error) { 75 m := new(ChangeNotification) 76 if err := x.ClientStream.RecvMsg(m); err != nil { 77 return nil, err 78 } 79 return m, nil 80 } 81 82 // PeerServer is the server API for Peer service. 83 // All implementations should embed UnimplementedPeerServer 84 // for forward compatibility 85 // 86 // Peer lists hubble peers and notifies of changes. 87 type PeerServer interface { 88 // Notify sends information about hubble peers in the cluster. 89 // When Notify is called, it sends information about all the peers that are 90 // already part of the cluster (with the type as PEER_ADDED). It 91 // subsequently notifies of any change. 92 Notify(*NotifyRequest, Peer_NotifyServer) error 93 } 94 95 // UnimplementedPeerServer should be embedded to have forward compatible implementations. 96 type UnimplementedPeerServer struct { 97 } 98 99 func (UnimplementedPeerServer) Notify(*NotifyRequest, Peer_NotifyServer) error { 100 return status.Errorf(codes.Unimplemented, "method Notify not implemented") 101 } 102 103 // UnsafePeerServer may be embedded to opt out of forward compatibility for this service. 104 // Use of this interface is not recommended, as added methods to PeerServer will 105 // result in compilation errors. 106 type UnsafePeerServer interface { 107 mustEmbedUnimplementedPeerServer() 108 } 109 110 func RegisterPeerServer(s grpc.ServiceRegistrar, srv PeerServer) { 111 s.RegisterService(&Peer_ServiceDesc, srv) 112 } 113 114 func _Peer_Notify_Handler(srv interface{}, stream grpc.ServerStream) error { 115 m := new(NotifyRequest) 116 if err := stream.RecvMsg(m); err != nil { 117 return err 118 } 119 return srv.(PeerServer).Notify(m, &peerNotifyServer{ServerStream: stream}) 120 } 121 122 type Peer_NotifyServer interface { 123 Send(*ChangeNotification) error 124 grpc.ServerStream 125 } 126 127 type peerNotifyServer struct { 128 grpc.ServerStream 129 } 130 131 func (x *peerNotifyServer) Send(m *ChangeNotification) error { 132 return x.ServerStream.SendMsg(m) 133 } 134 135 // Peer_ServiceDesc is the grpc.ServiceDesc for Peer service. 136 // It's only intended for direct use with grpc.RegisterService, 137 // and not to be introspected or modified (even as a copy) 138 var Peer_ServiceDesc = grpc.ServiceDesc{ 139 ServiceName: "peer.Peer", 140 HandlerType: (*PeerServer)(nil), 141 Methods: []grpc.MethodDesc{}, 142 Streams: []grpc.StreamDesc{ 143 { 144 StreamName: "Notify", 145 Handler: _Peer_Notify_Handler, 146 ServerStreams: true, 147 }, 148 }, 149 Metadata: "peer/peer.proto", 150 }