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

H
refact  
Hongze Cheng 已提交
16
#include "tdbInt.h"
H
Hongze Cheng 已提交
17

H
refact  
Hongze Cheng 已提交
18
// static int tdbOpenImpl(TDB *dbp);
H
Hongze Cheng 已提交
19

H
refact  
Hongze Cheng 已提交
20 21 22 23
// int tdbOpen(TDB **dbpp, const char *fname, const char *dbname, uint32_t flags) {
//   TDB *       dbp;
//   TDB_MPFILE *mpf;
//   uint8_t     fileid[TDB_FILE_ID_LEN];
H
Hongze Cheng 已提交
24

H
refact  
Hongze Cheng 已提交
25 26 27
//   if ((dbp = (TDB *)calloc(1, sizeof(*dbp))) == NULL) {
//     return -1;
//   }
H
Hongze Cheng 已提交
28

H
refact  
Hongze Cheng 已提交
29 30 31 32
//   if ((dbp->fname = strdup(fname)) == NULL) {
//     free(dbp);
//     return -1;
//   }
H
Hongze Cheng 已提交
33

H
refact  
Hongze Cheng 已提交
34 35 36 37 38
//   if ((dbname) && ((dbp->dbname = strdup(dbname)) == NULL)) {
//     free(dbp->fname);
//     free(dbp);
//     return -1;
//   }
H
Hongze Cheng 已提交
39

H
refact  
Hongze Cheng 已提交
40 41 42 43
//   // if (tdbGnrtFileID(fname, fileid) < 0) {
//   //   // todo
//   //   return -1;
//   // }
H
Hongze Cheng 已提交
44

H
refact  
Hongze Cheng 已提交
45 46 47 48 49
//   // TODO: mpf = tdbGetMPFileByID(fileid);
//   if (mpf == NULL) {
//     // todoerr: maybe we need to create one
//     return -1;
//   }
H
Hongze Cheng 已提交
50

H
refact  
Hongze Cheng 已提交
51 52 53 54
//   if (tdbOpenImpl(dbp) < 0) {
//     // todoerr
//     return -1;
//   }
H
Hongze Cheng 已提交
55

H
refact  
Hongze Cheng 已提交
56 57 58
//   *dbpp = dbp;
//   return 0;
// }
H
Hongze Cheng 已提交
59

H
refact  
Hongze Cheng 已提交
60 61 62 63
// int tdbClose(TDB *dbp, uint32_t flags) {
//   // TODO
//   return 0;
// }
H
Hongze Cheng 已提交
64

H
refact  
Hongze Cheng 已提交
65 66 67 68 69 70 71 72 73
// static int tdbOpenImpl(TDB *dbp) {
//   if (dbp->dbname == NULL) {
//     // todo: open the DB as a master DB
//   } else {
//     // todo: open the DB as a sub-db
//   }
//   // TODO
//   return 0;
// }