| 714 | } |
| 715 | |
| 716 | int AFCKernelModule::OnDelaySyncData(const AFGUID& self, const ArkDataMask mask_value, const AFDelaySyncData& data) |
| 717 | { |
| 718 | if (data.node_list_.size() == 0 && data.table_list_.size() == 0) |
| 719 | { |
| 720 | return 0; |
| 721 | } |
| 722 | |
| 723 | // find parent entity |
| 724 | auto pEntity = GetEntity(self); |
| 725 | if (pEntity == nullptr) |
| 726 | { |
| 727 | ARK_LOG_ERROR("sync delay data failed entity do no exist, self={}", self); |
| 728 | return -1; |
| 729 | } |
| 730 | |
| 731 | AFMsg::pb_delay_entity pb_data; |
| 732 | auto entity_id = self; |
| 733 | auto pb_entity = pb_data.mutable_data(); |
| 734 | |
| 735 | auto pParentContainer = pEntity->GetParentContainer(); |
| 736 | if (pParentContainer != nullptr) |
| 737 | { |
| 738 | if (!TryAddContainerPBEntity(pParentContainer, self, *pb_data.mutable_data(), entity_id, pb_entity)) |
| 739 | { |
| 740 | ARK_LOG_ERROR("sync delay data failed container entity do no exist, self={}", self); |
| 741 | return -1; |
| 742 | } |
| 743 | } |
| 744 | |
| 745 | // node to pb |
| 746 | for (auto& iter : data.node_list_) |
| 747 | { |
| 748 | auto pNode = iter; |
| 749 | if (!NodeToPBData(pNode, pb_entity)) |
| 750 | { |
| 751 | continue; |
| 752 | } |
| 753 | } |
| 754 | |
| 755 | // table to pb |
| 756 | for (auto& iter : data.table_list_) |
| 757 | { |
| 758 | auto table_index = iter.first; |
| 759 | auto& table = iter.second; |
| 760 | DelayTableToPB(table, table_index, pb_data, *pb_entity); |
| 761 | } |
| 762 | |
| 763 | // container to pb |
| 764 | for (auto& iter : data.container_list_) |
| 765 | { |
| 766 | auto container_index = iter.first; |
| 767 | auto& container = iter.second; |
| 768 | DelayContainerToPB(pEntity, container, container_index, pb_data); |
| 769 | } |
| 770 | |
| 771 | pb_data.set_id(entity_id); |
| 772 | |
| 773 | if (SendSyncMsg(entity_id, mask_value, pb_data) < 0) |
nothing calls this directly
no test coverage detected