LCOV - code coverage report
Current view: top level - server/fsm - state_define.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 80.0 % 10 8
Test Date: 2026-08-12 11:05:07 Functions: 100.0 % 2 2

            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              : #ifndef DGW_STATE_DEFINE_H
      12              : #define DGW_STATE_DEFINE_H
      13              : 
      14              : #include <memory>
      15              : #include "common/bqs_log.h"
      16              : 
      17              : namespace dgw {
      18              : class Entity;
      19              : using EntityPtr = std::shared_ptr<Entity>;
      20              : class ChannelEntity;
      21              : using ChannelEntityPtr = std::shared_ptr<ChannelEntity>;
      22              : 
      23              : enum class FsmStatus : int32_t {
      24              :     FSM_SUCCESS = 0,
      25              :     FSM_DEST_FULL,
      26              :     FSM_KEEP_STATE,
      27              :     FSM_ERROR_PENDING,
      28              :     FSM_FAILED,
      29              :     FSM_CACHED,
      30              :     FSM_ERROR,
      31              :     FSM_SRC_EMPTY
      32              : };
      33              : 
      34              : enum class InnerMsgType : int32_t { INNER_MSG_PUSH = 0, INNER_MSG_F2NF, INNER_MSG_RECOVER, INNER_MSG_INVALID };
      35              : 
      36              : struct InnerMessage {
      37              :     InnerMsgType msgType = InnerMsgType::INNER_MSG_INVALID;
      38              : };
      39              : 
      40            3 : inline const char_t* GetMsgDesc(const InnerMessage& msg)
      41              : {
      42            3 :     if ((msg.msgType >= InnerMsgType::INNER_MSG_PUSH) && (msg.msgType <= InnerMsgType::INNER_MSG_RECOVER)) {
      43            3 :         const char_t* const msgDesc[static_cast<int32_t>(InnerMsgType::INNER_MSG_INVALID)] = {
      44              :             "PUSH", "F2NF", "RECOVER"};
      45              : 
      46            3 :         return msgDesc[static_cast<int32_t>(msg.msgType)];
      47              :     } else {
      48            0 :         return "INNER_MSG_INVALID";
      49              :     }
      50              : }
      51              : 
      52              : enum class EntityType : int32_t { ENTITY_QUEUE = 0, ENTITY_TAG, ENTITY_GROUP, ENTITY_INVALID };
      53              : 
      54              : enum class EntityDirection : int32_t { DIRECTION_SEND = 0, DIRECTION_RECV, DIRECTION_INVALID };
      55              : 
      56         1169 : inline const char_t* GetDirectionDesc(const EntityDirection direction)
      57              : {
      58         1169 :     if ((direction >= EntityDirection::DIRECTION_SEND) && (direction <= EntityDirection::DIRECTION_RECV)) {
      59         1169 :         const char_t* const directionDesc[static_cast<int32_t>(EntityDirection::DIRECTION_INVALID)] = {"SEND", "RECV"};
      60              : 
      61         1169 :         return directionDesc[static_cast<int32_t>(direction)];
      62              :     } else {
      63            0 :         return "DIRECTION_INVALID";
      64              :     }
      65              : }
      66              : 
      67              : enum class FsmState : int32_t {
      68              :     FSM_BASE_STATE = 0,
      69              :     FSM_IDLE_STATE,
      70              :     FSM_PEEK_STATE,
      71              :     FSM_TRY_PUSH_STATE,
      72              :     FSM_WAIT_PUSH_STATE,
      73              :     FSM_PUSH_STATE,
      74              :     FSM_FULL_STATE,
      75              :     FSM_ERROR_STATE,
      76              :     FSM_INVALID_STATE
      77              : };
      78              : 
      79              : enum class AsyncDataState : int32_t {
      80              :     FSM_ASYNC_DATA_INIT = 0,
      81              :     FSM_ASYNC_DATA_WAIT,
      82              :     FSM_ASYNC_DATA_SENT,
      83              :     FSM_ASYNC_ENTITY_DONE,
      84              :     FSM_ASYNC_DATA_INVALID
      85              : };
      86              : 
      87              : enum class SubscribeStatus : int32_t { SUBSCRIBE_PAUSE = 0, SUBSCRIBE_RESUME, SUBSCRIBE_INVALID };
      88              : 
      89              : enum class BufEventType : int32_t {
      90              :     BUF_EVENT_DEL = 0,
      91              :     BUF_EVENT_ADD,
      92              : };
      93              : 
      94              : enum class ChannelLinkStatus : int32_t {
      95              :     UNCONNECTED = 0,
      96              :     CONNECTED,
      97              :     ABNORMAL,
      98              : };
      99              : } // namespace dgw
     100              : #endif
        

Generated by: LCOV version 2.0-1