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

Method OnSyncNode

src/plugin/kernel/src/AFCKernelModule.cpp:610–649  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

608}
609
610int AFCKernelModule::OnSyncNode(
611 const AFGUID& self, const uint32_t index, const ArkDataMask mask_value, const AFIData& data)
612{
613 // find parent entity
614 auto pEntity = GetEntity(self);
615 if (pEntity == nullptr)
616 {
617 ARK_LOG_ERROR("sync node failed entity do no exist, self={}", self);
618 return -1;
619 }
620
621 AFMsg::pb_entity pb_data;
622 auto entity_id = self;
623 auto pb_entity = pb_data.mutable_data();
624
625 auto pParentContainer = pEntity->GetParentContainer();
626 if (pParentContainer != nullptr)
627 {
628 if (!TryAddContainerPBEntity(pParentContainer, self, *pb_data.mutable_data(), entity_id, pb_entity))
629 {
630 ARK_LOG_ERROR("sync node failed container entity do no exist, self={}", self);
631 return -1;
632 }
633 }
634
635 if (!NodeToPBData(index, data, pb_entity))
636 {
637 ARK_LOG_ERROR("node to pb failed, self={}, index={}", self, index);
638 return -1;
639 }
640
641 pb_data.set_id(entity_id);
642 if (SendSyncMsg(entity_id, mask_value, pb_data) < 0)
643 {
644 ARK_LOG_ERROR("send sync msg failed, self={}, index={}", entity_id, index);
645 return -1;
646 }
647
648 return 0;
649}
650
651int AFCKernelModule::OnSyncTable(
652 const AFGUID& self, const TABLE_EVENT_DATA& event, const ArkDataMask mask_value, const AFIData& data)

Callers

nothing calls this directly

Calls 1

GetParentContainerMethod · 0.80

Tested by

no test coverage detected