// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 // - protoc v3.21.7 // source: registry.proto package registry import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.64.0 or later. const _ = grpc.SupportPackageIsVersion9 const ( Registry_Report_FullMethodName = "/registry.Registry/Report" Registry_List_FullMethodName = "/registry.Registry/List" Registry_Watch_FullMethodName = "/registry.Registry/Watch" ) // RegistryClient is the client API for Registry service. // // 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. // // Registry is invoked by services to inform type RegistryClient interface { // Report is periodically sent by each service to confirm it is still serving // with the registry data is persisted with a certain TTL Report(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error) // List returns current snapshot of the services known to the registry List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ServiceList, error) // Watch returns a stream of updates // for the simplicity of consumer its delivered as full snapshots // and is only sent when change is detected Watch(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ServiceList], error) } type registryClient struct { cc grpc.ClientConnInterface } func NewRegistryClient(cc grpc.ClientConnInterface) RegistryClient { return ®istryClient{cc} } func (c *registryClient) Report(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(RegisterResponse) err := c.cc.Invoke(ctx, Registry_Report_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *registryClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ServiceList, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ServiceList) err := c.cc.Invoke(ctx, Registry_List_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *registryClient) Watch(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ServiceList], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Registry_ServiceDesc.Streams[0], Registry_Watch_FullMethodName, cOpts...) if err != nil { return nil, err } x := &grpc.GenericClientStream[ListRequest, ServiceList]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } if err := x.ClientStream.CloseSend(); err != nil { return nil, err } return x, nil } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type Registry_WatchClient = grpc.ServerStreamingClient[ServiceList] // RegistryServer is the server API for Registry service. // All implementations should embed UnimplementedRegistryServer // for forward compatibility. // // Registry is invoked by services to inform type RegistryServer interface { // Report is periodically sent by each service to confirm it is still serving // with the registry data is persisted with a certain TTL Report(context.Context, *RegisterRequest) (*RegisterResponse, error) // List returns current snapshot of the services known to the registry List(context.Context, *ListRequest) (*ServiceList, error) // Watch returns a stream of updates // for the simplicity of consumer its delivered as full snapshots // and is only sent when change is detected Watch(*ListRequest, grpc.ServerStreamingServer[ServiceList]) error } // UnimplementedRegistryServer should be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil // pointer dereference when methods are called. type UnimplementedRegistryServer struct{} func (UnimplementedRegistryServer) Report(context.Context, *RegisterRequest) (*RegisterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Report not implemented") } func (UnimplementedRegistryServer) List(context.Context, *ListRequest) (*ServiceList, error) { return nil, status.Errorf(codes.Unimplemented, "method List not implemented") } func (UnimplementedRegistryServer) Watch(*ListRequest, grpc.ServerStreamingServer[ServiceList]) error { return status.Errorf(codes.Unimplemented, "method Watch not implemented") } func (UnimplementedRegistryServer) testEmbeddedByValue() {} // UnsafeRegistryServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to RegistryServer will // result in compilation errors. type UnsafeRegistryServer interface { mustEmbedUnimplementedRegistryServer() } func RegisterRegistryServer(s grpc.ServiceRegistrar, srv RegistryServer) { // If the following call pancis, it indicates UnimplementedRegistryServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { t.testEmbeddedByValue() } s.RegisterService(&Registry_ServiceDesc, srv) } func _Registry_Report_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(RegisterRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(RegistryServer).Report(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: Registry_Report_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(RegistryServer).Report(ctx, req.(*RegisterRequest)) } return interceptor(ctx, in, info, handler) } func _Registry_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(RegistryServer).List(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: Registry_List_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(RegistryServer).List(ctx, req.(*ListRequest)) } return interceptor(ctx, in, info, handler) } func _Registry_Watch_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(ListRequest) if err := stream.RecvMsg(m); err != nil { return err } return srv.(RegistryServer).Watch(m, &grpc.GenericServerStream[ListRequest, ServiceList]{ServerStream: stream}) } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type Registry_WatchServer = grpc.ServerStreamingServer[ServiceList] // Registry_ServiceDesc is the grpc.ServiceDesc for Registry service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var Registry_ServiceDesc = grpc.ServiceDesc{ ServiceName: "registry.Registry", HandlerType: (*RegistryServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Report", Handler: _Registry_Report_Handler, }, { MethodName: "List", Handler: _Registry_List_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Watch", Handler: _Registry_Watch_Handler, ServerStreams: true, }, }, Metadata: "registry.proto", }