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

#include "trbtree.h"
H
Hongze Cheng 已提交
17
#include "tsdbDataFileRW.h"
H
Hongze Cheng 已提交
18
#include "tsdbDef.h"
H
Hongze Cheng 已提交
19
#include "tsdbSttFileRW.h"
H
Hongze Cheng 已提交
20 21 22 23 24 25 26 27 28 29 30 31

#ifndef _TSDB_ITER_H_
#define _TSDB_ITER_H_

#ifdef __cplusplus
extern "C" {
#endif

typedef struct SIterMerger SIterMerger;
typedef struct STsdbIter   STsdbIter;
typedef TARRAY2(STsdbIter *) TTsdbIterArray;

H
Hongze Cheng 已提交
32 33 34 35
typedef enum {
  TSDB_ITER_TYPE_STT = 1,
  TSDB_ITER_TYPE_DATA,
  TSDB_ITER_TYPE_MEMT,
H
Hongze Cheng 已提交
36 37
  TSDB_ITER_TYPE_STT_TOMB,
  TSDB_ITER_TYPE_DATA_TOMB,
H
Hongze Cheng 已提交
38
  TSDB_ITER_TYPE_MEMT_TOMB,
H
Hongze Cheng 已提交
39 40 41 42 43
} EIterType;

typedef struct {
  EIterType type;
  union {
H
Hongze Cheng 已提交
44 45
    SSttSegReader   *sttReader;   //  TSDB_ITER_TYPE_STT || TSDB_ITER_TYPE_STT_TOMB
    SDataFileReader *dataReader;  // TSDB_ITER_TYPE_DATA || TSDB_ITER_TYPE_DATA_TOMB
H
Hongze Cheng 已提交
46
    struct {
H
Hongze Cheng 已提交
47
      SMemTable *memt;  // TSDB_ITER_TYPE_MEMT_TOMB
H
Hongze Cheng 已提交
48
      TSDBKEY    from[1];
H
Hongze Cheng 已提交
49
    };  // TSDB_ITER_TYPE_MEMT
H
Hongze Cheng 已提交
50
  };
H
Hongze Cheng 已提交
51 52
  bool    filterByVersion;
  int64_t verRange[2];
H
Hongze Cheng 已提交
53 54
} STsdbIterConfig;

H
Hongze Cheng 已提交
55
// STsdbIter ===============
H
Hongze Cheng 已提交
56 57 58
int32_t tsdbIterOpen(const STsdbIterConfig *config, STsdbIter **iter);
int32_t tsdbIterClose(STsdbIter **iter);
int32_t tsdbIterNext(STsdbIter *iter);
H
Hongze Cheng 已提交
59 60

// SIterMerger ===============
H
Hongze Cheng 已提交
61 62 63 64 65 66
int32_t tsdbIterMergerOpen(const TTsdbIterArray *iterArray, SIterMerger **merger, bool isTomb);
int32_t tsdbIterMergerClose(SIterMerger **merger);
int32_t tsdbIterMergerNext(SIterMerger *merger);
int32_t tsdbIterMergerSkipTableData(SIterMerger *merger, const TABLEID *tbid);

SRowInfo    *tsdbIterMergerGetData(SIterMerger *merger);
H
Hongze Cheng 已提交
67
STombRecord *tsdbIterMergerGetTombRecord(SIterMerger *merger);
H
Hongze Cheng 已提交
68 69 70 71 72 73

#ifdef __cplusplus
}
#endif

#endif /*_TSDB_ITER_H_*/