LCOV - code coverage report
Current view: top level - server/fsm - full_state.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 19 19
Test Date: 2026-07-28 10:54:05 Functions: 100.0 % 3 3

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #include "fsm/full_state.h"
      12              : #include "entity_manager.h"
      13              : #include "data_obj_manager.h"
      14              : #include "common/bqs_log.h"
      15              : #include "state_manager.h"
      16              : 
      17              : namespace dgw {
      18            2 : FsmStatus FullState::PreProcess(Entity &entity)
      19              : {
      20            2 :     DGW_LOG_INFO("[FSM] Entity id:[%u] type:[%s] state:[%s] desc:[%s].",
      21              :         entity.GetId(), entity.GetTypeDesc().c_str(),
      22              :         entity.GetStateDesc(FsmState::FSM_FULL_STATE).c_str(), entity.ToString().c_str());
      23            2 :     dgw::EntityManager::Instance(entity.GetResIndex()).SetExistFullEntity();
      24            2 :     auto &recvDataObjs = entity.GetRecvDataObjs();
      25            2 :     if (dgw::EntityManager::Instance(entity.GetResIndex()).ShouldPauseSubscirpiton()) {
      26            4 :         for (const auto &dataObj : recvDataObjs) {
      27            2 :             auto const sendEntity = dataObj->GetSendEntity();
      28            2 :             if (sendEntity != nullptr) {
      29            2 :                 (void)sendEntity->PauseSubscribe(entity);
      30              :             }
      31              :         }
      32              :     }
      33            2 :     return FsmStatus::FSM_SUCCESS;
      34              : }
      35              : 
      36            6 : FsmStatus FullState::ProcessMessage(Entity &entity, const InnerMessage &msg)
      37              : {
      38            6 :     if (msg.msgType == InnerMsgType::INNER_MSG_PUSH) {
      39            2 :         return FsmStatus::FSM_SUCCESS;
      40            4 :     } else if (msg.msgType == InnerMsgType::INNER_MSG_F2NF) {
      41            2 :         entity.SetMessageType(msg.msgType);
      42            2 :         return PostProcess(entity);
      43              :     } else {
      44            2 :         return FsmStatus::FSM_SUCCESS;
      45              :     }
      46              : }
      47              : 
      48            2 : FsmStatus FullState::PostProcess(Entity &entity)
      49              : {
      50            2 :     return entity.ChangeState(FsmState::FSM_PUSH_STATE);
      51              : }
      52              : 
      53              : REGISTER_STATE(FSM_FULL_STATE, ENTITY_QUEUE, FullState);
      54              : REGISTER_STATE(FSM_FULL_STATE, ENTITY_TAG, FullState);
      55              : }  // namespace dgw
        

Generated by: LCOV version 2.0-1