提交 e04bccdc 编写于 作者: H Hongze Cheng

refact

上级 ff33e67f
...@@ -26,8 +26,8 @@ extern "C" { ...@@ -26,8 +26,8 @@ extern "C" {
struct SMeta { struct SMeta {
char* path; // path of current meta char* path; // path of current meta
SMetaOptions options; // meta option SMetaOptions options; // meta option
SMetaDB* pMetaDB; // meta DB for real storage engine SMetaDB metaDB; // meta DB for real storage engine
STbUidGenerator uidGenerator; // meta table UID generator STbUidGenerator uidGnrt; // meta table UID generator
}; };
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -11,4 +11,41 @@ ...@@ -11,4 +11,41 @@
* *
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
\ No newline at end of file
#include "meta.h"
#include "metaDef.h"
int metaOpenDB(SMeta *pMeta) {
/* TODO */
pMeta->metaDB.pDB = tkvOpen(NULL, "db");
if (pMeta->metaDB.pDB == NULL) {
// TODO
return -1;
}
pMeta->metaDB.pIdx = tkvOpen(NULL, "index");
if (pMeta->metaDB.pIdx == NULL) {
/* TODO */
return -1;
}
{ /* TODO: for cache*/
}
return 0;
}
void metaCloseDB(SMeta *pMeta) { /* TODO */
{
// TODO: clear cache
}
if (pMeta->metaDB.pIdx) {
tkvClose(pMeta->metaDB.pIdx);
}
if (pMeta->metaDB.pDB) {
tkvClose(pMeta->metaDB.pIdx);
}
}
\ No newline at end of file
...@@ -57,14 +57,14 @@ SMeta *metaOpen(const char *path, const SMetaOptions *pMetaOptions) { ...@@ -57,14 +57,14 @@ SMeta *metaOpen(const char *path, const SMetaOptions *pMetaOptions) {
return NULL; return NULL;
} }
tableUidGeneratorInit(&(pMeta->uidGenerator), IVLD_TB_UID); tableUidGeneratorInit(&(pMeta->uidGnrt), IVLD_TB_UID);
return pMeta; return pMeta;
} }
void metaClose(SMeta *pMeta) { void metaClose(SMeta *pMeta) {
if (pMeta) { if (pMeta) {
tableUidGeneratorClear(&pMeta->uidGenerator); tableUidGeneratorClear(&pMeta->uidGnrt);
metaCloseDB(pMeta); metaCloseDB(pMeta);
free(pMeta); free(pMeta);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册