MCPcopy Create free account
hub / github.com/OpenArkStudio/ARK / OnSyncTableUpdate

Method OnSyncTableUpdate

src/plugin/kernel/src/AFCKernelModule.cpp:872–912  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

870}
871
872int AFCKernelModule::OnSyncTableUpdate(
873 const AFGUID& self, const TABLE_EVENT_DATA& event, const ArkDataMask mask_value, const AFIData& data)
874{
875 // find parent entity
876 auto pEntity = GetEntity(self);
877 if (pEntity == nullptr)
878 {
879 ARK_LOG_ERROR("sync table failed entity do no exist, self={}", self);
880 return -1;
881 }
882
883 AFMsg::pb_entity_table_update pb_data;
884 auto entity_id = self;
885 auto pb_entity = pb_data.mutable_data();
886
887 auto pParentContainer = pEntity->GetParentContainer();
888 if (pParentContainer != nullptr)
889 {
890 if (!TryAddContainerPBEntity(pParentContainer, self, *pb_data.mutable_data(), entity_id, pb_entity))
891 {
892 ARK_LOG_ERROR("sync node failed container entity do no exist, self={}", self);
893 return -1;
894 }
895 }
896
897 AFMsg::pb_entity_data pb_row;
898 if (!NodeToPBData(event.data_index_, data, &pb_row))
899 {
900 ARK_LOG_ERROR(
901 "sync table failed table node do no exist, self={}, table={}, row={}", self, event.table_name_, event.row_);
902 return -1;
903 }
904
905 AFMsg::pb_table pb_table;
906 pb_table.mutable_datas_value()->insert({event.row_, pb_row});
907 pb_entity->mutable_datas_table()->insert({event.table_index_, pb_table});
908
909 pb_data.set_id(entity_id);
910 SendSyncMsg(entity_id, mask_value, pb_data);
911 return 0;
912}
913
914int AFCKernelModule::OnSyncContainerPlace(
915 const AFGUID& self, const uint32_t index, const ArkDataMask mask, uint32_t src_index)

Callers

nothing calls this directly

Calls 2

GetParentContainerMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected