diff --git a/pkg/internal/grpc/services.go b/pkg/internal/grpc/services.go index 5255307..81f9f49 100644 --- a/pkg/internal/grpc/services.go +++ b/pkg/internal/grpc/services.go @@ -3,6 +3,7 @@ package grpc import ( "context" "fmt" + "time" "git.solsynth.dev/hydrogen/dealer/pkg/internal/directory" "git.solsynth.dev/hydrogen/dealer/pkg/proto" @@ -10,7 +11,7 @@ import ( "github.com/samber/lo" ) -func warpServiceInstanceToInfo(in *directory.ServiceInstance) *proto.ServiceInfo { +func convertServiceToInfo(in *directory.ServiceInstance) *proto.ServiceInfo { if in == nil { return nil } @@ -27,13 +28,13 @@ func (v *Server) GetService(ctx context.Context, request *proto.GetServiceReques if request.Id != nil { out := directory.GetServiceInstance(request.GetId()) return &proto.GetServiceResponse{ - Data: warpServiceInstanceToInfo(out), + Data: convertServiceToInfo(out), }, nil } if request.Type != nil { out := directory.GetServiceInstanceByType(request.GetType()) return &proto.GetServiceResponse{ - Data: warpServiceInstanceToInfo(out), + Data: convertServiceToInfo(out), }, nil } return nil, fmt.Errorf("no filter condition is provided") @@ -48,7 +49,7 @@ func (v *Server) ListService(ctx context.Context, request *proto.ListServiceRequ } return &proto.ListServiceResponse{ Data: lo.Map(out, func(item *directory.ServiceInstance, index int) *proto.ServiceInfo { - return warpServiceInstanceToInfo(item) + return convertServiceToInfo(item) }), }, nil } @@ -75,3 +76,17 @@ func (v *Server) RemoveService(ctx context.Context, request *proto.RemoveService IsSuccess: true, }, nil } + +func (v *Server) BroadcastDeletion(ctx context.Context, request *proto.DeletionRequest) (*proto.DeletionResponse, error) { + for _, service := range directory.ListServiceInstance() { + conn, err := service.GetGrpcConn() + if err != nil { + continue + } + pc := proto.NewServiceDirectoryClient(conn) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + _, err = pc.BroadcastDeletion(ctx, request) + cancel() + } + return &proto.DeletionResponse{}, nil +} diff --git a/pkg/proto/services.pb.go b/pkg/proto/services.pb.go index b198ccb..fe7ae09 100644 --- a/pkg/proto/services.pb.go +++ b/pkg/proto/services.pb.go @@ -436,6 +436,99 @@ func (x *RemoveServiceResponse) GetIsSuccess() bool { return false } +type DeletionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ResourceType string `protobuf:"bytes,1,opt,name=resource_type,json=resourceType,proto3" json:"resource_type,omitempty"` + ResourceId string `protobuf:"bytes,2,opt,name=resource_id,json=resourceId,proto3" json:"resource_id,omitempty"` +} + +func (x *DeletionRequest) Reset() { + *x = DeletionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_services_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeletionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletionRequest) ProtoMessage() {} + +func (x *DeletionRequest) ProtoReflect() protoreflect.Message { + mi := &file_services_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeletionRequest.ProtoReflect.Descriptor instead. +func (*DeletionRequest) Descriptor() ([]byte, []int) { + return file_services_proto_rawDescGZIP(), []int{8} +} + +func (x *DeletionRequest) GetResourceType() string { + if x != nil { + return x.ResourceType + } + return "" +} + +func (x *DeletionRequest) GetResourceId() string { + if x != nil { + return x.ResourceId + } + return "" +} + +type DeletionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeletionResponse) Reset() { + *x = DeletionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_services_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeletionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletionResponse) ProtoMessage() {} + +func (x *DeletionResponse) ProtoReflect() protoreflect.Message { + mi := &file_services_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeletionResponse.ProtoReflect.Descriptor instead. +func (*DeletionResponse) Descriptor() ([]byte, []int) { + return file_services_proto_rawDescGZIP(), []int{9} +} + var File_services_proto protoreflect.FileDescriptor var file_services_proto_rawDesc = []byte{ @@ -475,27 +568,39 @@ var file_services_proto_rawDesc = []byte{ 0x02, 0x69, 0x64, 0x22, 0x36, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x09, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x32, 0xac, 0x02, 0x0a, 0x10, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, - 0x12, 0x43, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x18, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, - 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, - 0x0a, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x12, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x1a, - 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4c, 0x0a, 0x0d, - 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1b, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, + 0x52, 0x09, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x57, 0x0a, 0x0f, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, + 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x49, 0x64, 0x22, 0x12, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xf4, 0x02, 0x0a, 0x10, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x43, 0x0a, + 0x0a, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x18, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, + 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x46, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0a, 0x41, 0x64, + 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0x19, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4c, 0x0a, 0x0d, 0x52, 0x65, 0x6d, + 0x6f, 0x76, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x11, 0x42, 0x72, 0x6f, 0x61, 0x64, + 0x63, 0x61, 0x73, 0x74, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, + 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -510,7 +615,7 @@ func file_services_proto_rawDescGZIP() []byte { return file_services_proto_rawDescData } -var file_services_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_services_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_services_proto_goTypes = []any{ (*ServiceInfo)(nil), // 0: proto.ServiceInfo (*GetServiceRequest)(nil), // 1: proto.GetServiceRequest @@ -520,6 +625,8 @@ var file_services_proto_goTypes = []any{ (*AddServiceResponse)(nil), // 5: proto.AddServiceResponse (*RemoveServiceRequest)(nil), // 6: proto.RemoveServiceRequest (*RemoveServiceResponse)(nil), // 7: proto.RemoveServiceResponse + (*DeletionRequest)(nil), // 8: proto.DeletionRequest + (*DeletionResponse)(nil), // 9: proto.DeletionResponse } var file_services_proto_depIdxs = []int32{ 0, // 0: proto.GetServiceResponse.data:type_name -> proto.ServiceInfo @@ -528,12 +635,14 @@ var file_services_proto_depIdxs = []int32{ 3, // 3: proto.ServiceDirectory.ListService:input_type -> proto.ListServiceRequest 0, // 4: proto.ServiceDirectory.AddService:input_type -> proto.ServiceInfo 6, // 5: proto.ServiceDirectory.RemoveService:input_type -> proto.RemoveServiceRequest - 2, // 6: proto.ServiceDirectory.GetService:output_type -> proto.GetServiceResponse - 4, // 7: proto.ServiceDirectory.ListService:output_type -> proto.ListServiceResponse - 5, // 8: proto.ServiceDirectory.AddService:output_type -> proto.AddServiceResponse - 7, // 9: proto.ServiceDirectory.RemoveService:output_type -> proto.RemoveServiceResponse - 6, // [6:10] is the sub-list for method output_type - 2, // [2:6] is the sub-list for method input_type + 8, // 6: proto.ServiceDirectory.BroadcastDeletion:input_type -> proto.DeletionRequest + 2, // 7: proto.ServiceDirectory.GetService:output_type -> proto.GetServiceResponse + 4, // 8: proto.ServiceDirectory.ListService:output_type -> proto.ListServiceResponse + 5, // 9: proto.ServiceDirectory.AddService:output_type -> proto.AddServiceResponse + 7, // 10: proto.ServiceDirectory.RemoveService:output_type -> proto.RemoveServiceResponse + 9, // 11: proto.ServiceDirectory.BroadcastDeletion:output_type -> proto.DeletionResponse + 7, // [7:12] is the sub-list for method output_type + 2, // [2:7] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name @@ -641,6 +750,30 @@ func file_services_proto_init() { return nil } } + file_services_proto_msgTypes[8].Exporter = func(v any, i int) any { + switch v := v.(*DeletionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_proto_msgTypes[9].Exporter = func(v any, i int) any { + switch v := v.(*DeletionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_services_proto_msgTypes[0].OneofWrappers = []any{} file_services_proto_msgTypes[1].OneofWrappers = []any{} @@ -651,7 +784,7 @@ func file_services_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_services_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/proto/services.proto b/pkg/proto/services.proto index d3b5733..df49a12 100644 --- a/pkg/proto/services.proto +++ b/pkg/proto/services.proto @@ -9,6 +9,7 @@ service ServiceDirectory { rpc ListService(ListServiceRequest) returns (ListServiceResponse) {} rpc AddService(ServiceInfo) returns (AddServiceResponse) {} rpc RemoveService(RemoveServiceRequest) returns (RemoveServiceResponse) {} + rpc BroadcastDeletion(DeletionRequest) returns (DeletionResponse) {} } message ServiceInfo { @@ -47,3 +48,11 @@ message RemoveServiceRequest { message RemoveServiceResponse { bool is_success = 1; } + +message DeletionRequest { + string resource_type = 1; + string resource_id = 2; +} + +message DeletionResponse { +} diff --git a/pkg/proto/services_grpc.pb.go b/pkg/proto/services_grpc.pb.go index 952af90..e5edfb8 100644 --- a/pkg/proto/services_grpc.pb.go +++ b/pkg/proto/services_grpc.pb.go @@ -19,10 +19,11 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - ServiceDirectory_GetService_FullMethodName = "/proto.ServiceDirectory/GetService" - ServiceDirectory_ListService_FullMethodName = "/proto.ServiceDirectory/ListService" - ServiceDirectory_AddService_FullMethodName = "/proto.ServiceDirectory/AddService" - ServiceDirectory_RemoveService_FullMethodName = "/proto.ServiceDirectory/RemoveService" + ServiceDirectory_GetService_FullMethodName = "/proto.ServiceDirectory/GetService" + ServiceDirectory_ListService_FullMethodName = "/proto.ServiceDirectory/ListService" + ServiceDirectory_AddService_FullMethodName = "/proto.ServiceDirectory/AddService" + ServiceDirectory_RemoveService_FullMethodName = "/proto.ServiceDirectory/RemoveService" + ServiceDirectory_BroadcastDeletion_FullMethodName = "/proto.ServiceDirectory/BroadcastDeletion" ) // ServiceDirectoryClient is the client API for ServiceDirectory service. @@ -33,6 +34,7 @@ type ServiceDirectoryClient interface { ListService(ctx context.Context, in *ListServiceRequest, opts ...grpc.CallOption) (*ListServiceResponse, error) AddService(ctx context.Context, in *ServiceInfo, opts ...grpc.CallOption) (*AddServiceResponse, error) RemoveService(ctx context.Context, in *RemoveServiceRequest, opts ...grpc.CallOption) (*RemoveServiceResponse, error) + BroadcastDeletion(ctx context.Context, in *DeletionRequest, opts ...grpc.CallOption) (*DeletionResponse, error) } type serviceDirectoryClient struct { @@ -83,6 +85,16 @@ func (c *serviceDirectoryClient) RemoveService(ctx context.Context, in *RemoveSe return out, nil } +func (c *serviceDirectoryClient) BroadcastDeletion(ctx context.Context, in *DeletionRequest, opts ...grpc.CallOption) (*DeletionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeletionResponse) + err := c.cc.Invoke(ctx, ServiceDirectory_BroadcastDeletion_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // ServiceDirectoryServer is the server API for ServiceDirectory service. // All implementations must embed UnimplementedServiceDirectoryServer // for forward compatibility. @@ -91,6 +103,7 @@ type ServiceDirectoryServer interface { ListService(context.Context, *ListServiceRequest) (*ListServiceResponse, error) AddService(context.Context, *ServiceInfo) (*AddServiceResponse, error) RemoveService(context.Context, *RemoveServiceRequest) (*RemoveServiceResponse, error) + BroadcastDeletion(context.Context, *DeletionRequest) (*DeletionResponse, error) mustEmbedUnimplementedServiceDirectoryServer() } @@ -113,6 +126,9 @@ func (UnimplementedServiceDirectoryServer) AddService(context.Context, *ServiceI func (UnimplementedServiceDirectoryServer) RemoveService(context.Context, *RemoveServiceRequest) (*RemoveServiceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RemoveService not implemented") } +func (UnimplementedServiceDirectoryServer) BroadcastDeletion(context.Context, *DeletionRequest) (*DeletionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BroadcastDeletion not implemented") +} func (UnimplementedServiceDirectoryServer) mustEmbedUnimplementedServiceDirectoryServer() {} func (UnimplementedServiceDirectoryServer) testEmbeddedByValue() {} @@ -206,6 +222,24 @@ func _ServiceDirectory_RemoveService_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } +func _ServiceDirectory_BroadcastDeletion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeletionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceDirectoryServer).BroadcastDeletion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ServiceDirectory_BroadcastDeletion_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceDirectoryServer).BroadcastDeletion(ctx, req.(*DeletionRequest)) + } + return interceptor(ctx, in, info, handler) +} + // ServiceDirectory_ServiceDesc is the grpc.ServiceDesc for ServiceDirectory service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -229,6 +263,10 @@ var ServiceDirectory_ServiceDesc = grpc.ServiceDesc{ MethodName: "RemoveService", Handler: _ServiceDirectory_RemoveService_Handler, }, + { + MethodName: "BroadcastDeletion", + Handler: _ServiceDirectory_BroadcastDeletion_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "services.proto",