-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMinisql.h
More file actions
44 lines (35 loc) · 1.11 KB
/
Minisql.h
File metadata and controls
44 lines (35 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef Minisql_Minisql_h
#define Minisql_Minisql_h
#include <stdio.h>
#include <time.h>
#include <iostream>
using namespace std;
struct blockNode
{
int offsetNum; // the offset number in the block list
bool pin; // the flag that this block is locked
bool ifbottom; // flag that this is the end of the file node
char* fileName; // the file which the block node belongs to
friend class BufferManager;
private:
char *address; // the content address
blockNode * preBlock;
blockNode * nextBlock;
bool reference; // the LRU replacement flag
bool dirty; // the flag that this block is dirty, which needs to written back to the disk later
size_t using_size; // the byte size that the block have used. The total size of the block is BLOCK_SIZE . This value is stored in the block head.
};
struct fileNode
{
char *fileName;
bool pin; // the flag that this file is locked
blockNode *blockHead;
fileNode * nextFile;
fileNode * preFile;
};
extern clock_t start;
extern void print();
#define MAX_FILE_NUM 40
#define MAX_BLOCK_NUM 300
#define MAX_FILE_NAME 100
#endif