Loading src/dlt/connector/service/DltConnectorServiceServicerImpl.py +28 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,34 @@ class DltConnectorServiceServicerImpl(DltConnectorServiceServicer): @safe_and_metered_rpc_method(METRICS_POOL, LOGGER) def RecordService(self, request : DltServiceId, context : grpc.ServicerContext) -> Empty: context_client = ContextClient() service = context_client.GetService(request.service_id) dltgateway_client = DltGatewayClient() dlt_record_id = DltRecordId() dlt_record_id.domain_uuid.uuid = request.topology_id.topology_uuid.uuid dlt_record_id.type = DltRecordTypeEnum.DLTRECORDTYPE_SERVICE dlt_record_id.record_uuid.uuid = service.service_id.service_uuid.uuid LOGGER.info('[RecordService] sent dlt_record_id = {:s}'.format(grpc_message_to_json_string(dlt_record_id))) dlt_record = dltgateway_client.GetFromDlt(dlt_record_id) LOGGER.info('[RecordService] recv dlt_record = {:s}'.format(grpc_message_to_json_string(dlt_record))) exists = record_exists(dlt_record) LOGGER.info('[RecordService] exists = {:s}'.format(str(exists))) dlt_record = DltRecord() dlt_record.record_id.CopyFrom(dlt_record_id) dlt_record.operation = \ DltRecordOperationEnum.DLTRECORDOPERATION_UPDATE \ if exists else \ DltRecordOperationEnum.DLTRECORDOPERATION_ADD dlt_record.data_json = grpc_message_to_json_string(service) LOGGER.info('[RecordService] sent dlt_record = {:s}'.format(grpc_message_to_json_string(dlt_record))) dlt_record_status = dltgateway_client.RecordToDlt(dlt_record) LOGGER.info('[RecordService] recv dlt_record_status = {:s}'.format(grpc_message_to_json_string(dlt_record_status))) return Empty() @safe_and_metered_rpc_method(METRICS_POOL, LOGGER) Loading Loading
src/dlt/connector/service/DltConnectorServiceServicerImpl.py +28 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,34 @@ class DltConnectorServiceServicerImpl(DltConnectorServiceServicer): @safe_and_metered_rpc_method(METRICS_POOL, LOGGER) def RecordService(self, request : DltServiceId, context : grpc.ServicerContext) -> Empty: context_client = ContextClient() service = context_client.GetService(request.service_id) dltgateway_client = DltGatewayClient() dlt_record_id = DltRecordId() dlt_record_id.domain_uuid.uuid = request.topology_id.topology_uuid.uuid dlt_record_id.type = DltRecordTypeEnum.DLTRECORDTYPE_SERVICE dlt_record_id.record_uuid.uuid = service.service_id.service_uuid.uuid LOGGER.info('[RecordService] sent dlt_record_id = {:s}'.format(grpc_message_to_json_string(dlt_record_id))) dlt_record = dltgateway_client.GetFromDlt(dlt_record_id) LOGGER.info('[RecordService] recv dlt_record = {:s}'.format(grpc_message_to_json_string(dlt_record))) exists = record_exists(dlt_record) LOGGER.info('[RecordService] exists = {:s}'.format(str(exists))) dlt_record = DltRecord() dlt_record.record_id.CopyFrom(dlt_record_id) dlt_record.operation = \ DltRecordOperationEnum.DLTRECORDOPERATION_UPDATE \ if exists else \ DltRecordOperationEnum.DLTRECORDOPERATION_ADD dlt_record.data_json = grpc_message_to_json_string(service) LOGGER.info('[RecordService] sent dlt_record = {:s}'.format(grpc_message_to_json_string(dlt_record))) dlt_record_status = dltgateway_client.RecordToDlt(dlt_record) LOGGER.info('[RecordService] recv dlt_record_status = {:s}'.format(grpc_message_to_json_string(dlt_record_status))) return Empty() @safe_and_metered_rpc_method(METRICS_POOL, LOGGER) Loading