2021-10-11 22:05:45 +08:00
|
|
|
//
|
|
|
|
// Created by YuhangQ on 2021/10/9.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef INVODB_COLLECTION_H
|
|
|
|
#define INVODB_COLLECTION_H
|
|
|
|
|
2021-10-23 16:28:57 +08:00
|
|
|
#include "file/page_manager.h"
|
|
|
|
#include "utils/logger.h"
|
2021-10-30 19:48:39 +08:00
|
|
|
#include "btree/btree.h"
|
2021-10-30 23:46:11 +08:00
|
|
|
#include "models/json.h"
|
2021-10-23 16:28:57 +08:00
|
|
|
#include <map>
|
|
|
|
#include <set>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <cstring>
|
2021-10-25 22:07:18 +08:00
|
|
|
#include "utils/uuid.h"
|
2021-10-11 22:05:45 +08:00
|
|
|
|
|
|
|
class Collection {
|
2021-10-23 16:28:57 +08:00
|
|
|
public:
|
|
|
|
static void insert(JSON &json);
|
|
|
|
static void loadCollections();
|
|
|
|
static Collection& getCollection(const std::string& name);
|
|
|
|
static Collection& createCollection(const std::string& name);
|
|
|
|
private:
|
|
|
|
static std::map<std::string, Collection*> map;
|
|
|
|
static std::set<int> free;
|
2021-10-30 23:46:11 +08:00
|
|
|
|
|
|
|
BTree<27, std::string, 32> *tree;
|
|
|
|
|
2021-10-23 16:28:57 +08:00
|
|
|
Collection(const std::string& name,const int& firstPage);
|
|
|
|
Collection() {}
|
|
|
|
~Collection() {}
|
|
|
|
Collection(const Collection&);
|
|
|
|
Collection& operator=(const Collection&);
|
2021-10-11 22:05:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //INVODB_COLLECTION_H
|