sdbInt.h 1.9 KB
Newer Older
S
Shengliang Guan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _TD_SDB_INT_H_
#define _TD_SDB_INT_H_

#include "os.h"
S
Shengliang Guan 已提交
20

S
Shengliang Guan 已提交
21
#include "sdb.h"
S
Shengliang Guan 已提交
22 23 24 25 26

#ifdef __cplusplus
extern "C" {
#endif

S
Shengliang Guan 已提交
27
// clang-format off
28 29 30 31 32 33
#define mFatal(...) { if (mDebugFlag & DEBUG_FATAL) { taosPrintLog("MND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }}
#define mError(...) { if (mDebugFlag & DEBUG_ERROR) { taosPrintLog("MND ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }}
#define mWarn(...)  { if (mDebugFlag & DEBUG_WARN)  { taosPrintLog("MND WARN ", DEBUG_WARN, 255, __VA_ARGS__); }}
#define mInfo(...)  { if (mDebugFlag & DEBUG_INFO)  { taosPrintLog("MND ", DEBUG_INFO, 255, __VA_ARGS__); }}
#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", DEBUG_DEBUG, mDebugFlag, __VA_ARGS__); }}
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }}
S
Shengliang Guan 已提交
34
// clang-format on
S
Shengliang Guan 已提交
35

S
Shengliang Guan 已提交
36
typedef struct SSdbRaw {
S
Shengliang Guan 已提交
37
  int8_t  type;
S
Shengliang Guan 已提交
38
  int8_t  status;
S
Shengliang Guan 已提交
39
  int8_t  sver;
S
Shengliang Guan 已提交
40
  int8_t  reserved;
S
Shengliang Guan 已提交
41 42 43 44 45
  int32_t dataLen;
  char    pData[];
} SSdbRaw;

typedef struct SSdbRow {
S
Shengliang Guan 已提交
46
  ESdbType   type;
S
Shengliang Guan 已提交
47 48 49 50 51
  ESdbStatus status;
  int32_t    refCount;
  char       pObj[];
} SSdbRow;

S
Shengliang Guan 已提交
52 53
const char *sdbTableName(ESdbType type);
void        sdbPrintOper(SSdb *pSdb, SSdbRow *pRow, const char *oper);
S
Shengliang Guan 已提交
54

S
Shengliang Guan 已提交
55 56
void sdbFreeRow(SSdb *pSdb, SSdbRow *pRow, bool callFunc);

S
Shengliang Guan 已提交
57 58 59 60 61
#ifdef __cplusplus
}
#endif

#endif /*_TD_SDB_INT_H_*/