InvoDB/invodb/btree/btree_node.h

44 lines
738 B
C
Raw Normal View History

2021-10-24 20:21:04 +08:00
//
// Created by i on 2021/10/24.
//
#ifndef INVODB_BTREE_NODE_H
#define INVODB_BTREE_NODE_H
#include <iostream>
#include <cstring>
2021-10-25 22:07:18 +08:00
#include <algorithm>
#include <map>
#include "file/page_manager.h"
2021-10-24 20:21:04 +08:00
/**
2021-10-26 12:29:59 +08:00
* m = 27
2021-10-25 22:07:18 +08:00
* value string max
* (32 + 4)*28 + 5 = 1013
2021-10-24 20:21:04 +08:00
*/
2021-10-25 22:07:18 +08:00
class BTreeNodeUUID {
2021-10-24 20:21:04 +08:00
public:
2021-10-25 22:07:18 +08:00
static BTreeNodeUUID* getNode(const int& address);
2021-10-26 12:29:59 +08:00
int insert(const std::string uuid);
void print();
void clear();
void save();
static const int m = 27;
std::string key[m+1];
2021-10-25 23:15:15 +08:00
int val[m+1];
2021-10-25 22:07:18 +08:00
int parent;
2021-10-26 12:29:59 +08:00
int left;
int right;
bool leaf;
int size;
int address;
2021-10-24 20:21:04 +08:00
private:
2021-10-26 12:29:59 +08:00
BTreeNodeUUID(const int& address);
2021-10-25 22:07:18 +08:00
static std::map<int, BTreeNodeUUID*> map;
2021-10-26 12:29:59 +08:00
2021-10-24 20:21:04 +08:00
};
#endif //INVODB_BTREE_NODE_H