tnote.h 1.7 KB
Newer Older
L
lihui 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
 * 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 TDENGINE_TNOTE_H
#define TDENGINE_TNOTE_H

#ifdef __cplusplus
extern "C" {
#endif

#define MAX_NOTE_LINE_SIZE 66000
#define NOTE_FILE_NAME_LEN 300
S
TD-2371  
Shengliang Guan 已提交
25 26 27 28 29 30 31 32 33 34 35 36 37 38

typedef struct {
  int32_t fileNum;
  int32_t maxLines;
  int32_t lines;
  int32_t flag;
  int32_t fd;
  int32_t openInProgress;
  char    name[NOTE_FILE_NAME_LEN];
  pthread_mutex_t mutex;
} SNoteObj;

extern SNoteObj tsHttpNote;
extern SNoteObj tsTscNote;
S
TD-2371  
Shengliang Guan 已提交
39
extern SNoteObj tsInfoNote;
S
TD-2371  
Shengliang Guan 已提交
40 41 42

void taosInitNotes();
void taosNotePrint(SNoteObj* pNote, const char* const format, ...);
S
TD-2371  
Shengliang Guan 已提交
43
void taosNotePrintBuffer(SNoteObj *pNote, char *buffer, int32_t len);
S
TD-2371  
Shengliang Guan 已提交
44 45

#define nPrintHttp(...)                      \
L
lihui 已提交
46
  if (tsHttpEnableRecordSql) {               \
S
TD-2371  
Shengliang Guan 已提交
47
    taosNotePrint(&tsHttpNote, __VA_ARGS__); \
L
lihui 已提交
48
  }
S
TD-2371  
Shengliang Guan 已提交
49 50 51 52 53 54

#define nPrintTsc(...)                      \
  if (tsTscEnableRecordSql) {               \
    taosNotePrint(&tsTscNote, __VA_ARGS__); \
  }

S
TD-2371  
Shengliang Guan 已提交
55 56 57 58
#define nInfo(buffer, len)                         \
  if (tscEmbedded == 1) {                          \
    taosNotePrintBuffer(&tsInfoNote, buffer, len); \
  }
L
lihui 已提交
59 60 61 62 63 64

#ifdef __cplusplus
}
#endif

#endif