add index tree

This commit is contained in:
YuhangQ 2021-11-02 11:35:41 +08:00
parent 0c05c4424c
commit 7e8d6d8e5a
2 changed files with 26 additions and 17 deletions

View File

@ -13,7 +13,7 @@ int main() {
srand(t);
printf("seed: %d\n", t);
//system("rm -rf test.invodb && touch test.invodb");
system("rm -rf test.invodb && touch test.invodb");
PageManager::loadDatabase("test.invodb");
@ -29,24 +29,31 @@ int main() {
col = &Collection::getCollection("hello");
}
testAndBenchmark(10000);
//testAndBenchmark(10000);
// nlohmann::json j = nlohmann::json::parse(R"(
//{
// "string": "this is a string!",
// "double": 3.1415,
// "int": 25565,
// "bool": true,
// "child": {
// "id": 3
// },
// "array": ["1", "2", "3"]
// )");
//
// col->insert(j);
//
// col->remove(j);
nlohmann::json j = nlohmann::json::parse(R"(
{
"string": "this is a string!",
"double": 3.1415,
"int": 25565,
"bool": true,
"child": {
"id": 3
},
"array": ["1", "2", "3"]
)");
try {
col->insert(j);
}catch(const char * s ){
puts(s);
}
printf("?");
col->remove(j);
return 0;
}

View File

@ -77,6 +77,8 @@ Collection::Collection(const std::string &name, const int &firstPage) {
}
void Collection::insert(nlohmann::json &json) {
if(json["__INVO_ID__"].empty()) {
json["__INVO_ID__"] = generateUUID();
} else {