Merge branch 'feature/vnode' of https://github.com/taosdata/TDengine into feature/vnode
This commit is contained in:
commit
cefd74f2d4
|
@ -44,7 +44,7 @@ typedef struct {
|
|||
|
||||
// TDB Operations
|
||||
TDB_EXTERN int tdbCreateDB(TDB** dbpp, tdb_db_t type);
|
||||
TDB_EXTERN int tdbOpenDB(TDB* dbp, uint32_t flags);
|
||||
TDB_EXTERN int tdbOpenDB(TDB* dbp, const char* fname, const char* dbname, uint32_t flags);
|
||||
TDB_EXTERN int tdbCloseDB(TDB* dbp, uint32_t flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -56,9 +56,28 @@ _err:
|
|||
return 0;
|
||||
}
|
||||
|
||||
TDB_EXTERN int tdbOpenDB(TDB* dbp, uint32_t flags) {
|
||||
// TODO
|
||||
return 0;
|
||||
TDB_EXTERN int tdbOpenDB(TDB* dbp, const char* fname, const char* dbname, uint32_t flags) {
|
||||
int ret = 0;
|
||||
|
||||
if ((dbp->fname = strdup(fname)) == NULL) {
|
||||
ret = -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Create the backup file if the file not exists
|
||||
|
||||
// Open the file as a sub-db or a master-db
|
||||
if (dbname) {
|
||||
if ((dbp->dbname = strdup(dbname)) == NULL) {
|
||||
ret = -1;
|
||||
return ret;
|
||||
}
|
||||
// TODO: Open the DB as a SUB-DB in this file
|
||||
} else {
|
||||
// TODO: Open the DB as a MASTER-DB in this file
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
TDB_EXTERN int tdbCloseDB(TDB* dbp, uint32_t flags) {
|
||||
|
|
|
@ -25,6 +25,14 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
// TODO
|
||||
} TDB_MPOOL;
|
||||
|
||||
typedef struct {
|
||||
int fd;
|
||||
} TDB_FH;
|
||||
|
||||
struct TDB {
|
||||
pgsize_t pageSize;
|
||||
tdb_db_t type;
|
||||
|
@ -35,6 +43,9 @@ struct TDB {
|
|||
TDB_HASH * hash;
|
||||
TDB_HEAP * heap;
|
||||
} dbam; // db access method
|
||||
|
||||
TDB_FH * fhp; // The backup file handle
|
||||
TDB_MPOOL *mph; // The memory pool handle
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -6,9 +6,9 @@ TEST(tdb_api_test, tdb_create_open_close_db_test) {
|
|||
int ret;
|
||||
TDB *dbp;
|
||||
|
||||
tdbCreateDB(&dbp, TDB_BTREE_T);
|
||||
// tdbCreateDB(&dbp, TDB_BTREE_T);
|
||||
|
||||
tdbOpenDB(dbp, 0);
|
||||
// tdbOpenDB(dbp, 0);
|
||||
|
||||
tdbCloseDB(dbp, 0);
|
||||
// tdbCloseDB(dbp, 0);
|
||||
}
|
Loading…
Reference in New Issue