refact
This commit is contained in:
parent
ff33e67f5b
commit
e04bccdca4
|
@ -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
|
||||||
|
|
|
@ -12,3 +12,40 @@
|
||||||
* 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/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue