This commit is contained in:
Hongze Cheng 2021-11-02 16:17:49 +08:00
parent ff33e67f5b
commit e04bccdca4
3 changed files with 42 additions and 5 deletions

View File

@ -26,8 +26,8 @@ extern "C" {
struct SMeta {
char* path; // path of current meta
SMetaOptions options; // meta option
SMetaDB* pMetaDB; // meta DB for real storage engine
STbUidGenerator uidGenerator; // meta table UID generator
SMetaDB metaDB; // meta DB for real storage engine
STbUidGenerator uidGnrt; // meta table UID generator
};
#ifdef __cplusplus

View File

@ -11,4 +11,41 @@
*
* 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 "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);
}
}

View File

@ -57,14 +57,14 @@ SMeta *metaOpen(const char *path, const SMetaOptions *pMetaOptions) {
return NULL;
}
tableUidGeneratorInit(&(pMeta->uidGenerator), IVLD_TB_UID);
tableUidGeneratorInit(&(pMeta->uidGnrt), IVLD_TB_UID);
return pMeta;
}
void metaClose(SMeta *pMeta) {
if (pMeta) {
tableUidGeneratorClear(&pMeta->uidGenerator);
tableUidGeneratorClear(&pMeta->uidGnrt);
metaCloseDB(pMeta);
free(pMeta);
}