tsdbUtil.h 2.2 KB
Newer Older
H
Hongze Cheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
 * 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 _TSDB_UTIL_H
#define _TSDB_UTIL_H

H
Hongze Cheng 已提交
19
#include "tsdbDef.h"
H
Hongze Cheng 已提交
20

H
Hongze Cheng 已提交
21 22 23 24
#ifdef __cplusplus
extern "C" {
#endif

H
Hongze Cheng 已提交
25 26 27
// SDelBlock ----------
typedef struct SDelBlock SDelBlock;
typedef struct SDelBlk   SDelBlk;
H
Hongze Cheng 已提交
28

H
Hongze Cheng 已提交
29
int32_t tDelBlockCreate(SDelBlock *pDelBlock, int32_t capacity);
H
Hongze Cheng 已提交
30 31 32
int32_t tDelBlockDestroy(SDelBlock *pDelBlock);
int32_t tDelBlockClear(SDelBlock *pDelBlock);
int32_t tDelBlockAppend(SDelBlock *pDelBlock, const TABLEID *tbid, const SDelData *pDelData);
H
Hongze Cheng 已提交
33

H
Hongze Cheng 已提交
34 35 36 37 38 39 40 41 42
// STbStatisBlock ----------
typedef struct STbStatisBlock STbStatisBlock;
typedef struct STbStatisBlk   STbStatisBlk;

int32_t tTbStatisBlockCreate(STbStatisBlock *pTbStatisBlock, int32_t capacity);
int32_t tTbStatisBlockDestroy(STbStatisBlock *pTbStatisBlock);
int32_t tTbStatisBlockClear(STbStatisBlock *pTbStatisBlock);

// other apis
H
Hongze Cheng 已提交
43 44 45
int32_t tsdbUpdateSkmTb(STsdb *pTsdb, const TABLEID *tbid, SSkmInfo *pSkmTb);
int32_t tsdbUpdateSkmRow(STsdb *pTsdb, const TABLEID *tbid, int32_t sver, SSkmInfo *pSkmRow);

H
Hongze Cheng 已提交
46
/* Exposed Structs */
H
Hongze Cheng 已提交
47
// <suid, uid, version, skey, ekey>
H
Hongze Cheng 已提交
48
struct SDelBlock {
H
Hongze Cheng 已提交
49 50 51
  int32_t  capacity;
  int32_t  nRow;
  int64_t *aData[5];  // [suid, uid, version, skey, ekey
H
Hongze Cheng 已提交
52 53 54
};

struct SDelBlk {
H
Hongze Cheng 已提交
55 56 57 58 59 60
  int32_t   nRow;
  TABLEID   minTid;
  TABLEID   maxTid;
  int64_t   minVer;
  int64_t   maxVer;
  SFDataPtr dp;
H
Hongze Cheng 已提交
61
};
H
Hongze Cheng 已提交
62

H
Hongze Cheng 已提交
63 64 65 66 67 68
struct STbStatisBlock {
  int32_t  capacity;
  int32_t  nRow;
  int64_t *aData[7];  // [suid, uid, skey, sver, ekey, ever, count]
};
struct STbStatisBlk {
H
Hongze Cheng 已提交
69 70 71 72 73 74
  int32_t   nRow;
  TABLEID   minTid;
  TABLEID   maxTid;
  int64_t   minVer;
  int64_t   maxVer;
  SFDataPtr dp;
H
Hongze Cheng 已提交
75
};
H
Hongze Cheng 已提交
76 77 78 79 80 81

#ifdef __cplusplus
}
#endif

#endif /*_TSDB_UTIL_H*/