SwatDB
include
heapfile.h
Go to the documentation of this file.
1
/*
2
* SwatDB
3
*
4
* @authors: See Contributors.doc for code contributors
5
*
6
* Copyright (c) 2020 Swarthmore College Computer Science Department
7
* Swarthmore PA, Professors Tia Newhall, Ameet Soni
8
*/
9
10
#pragma once
11
16
#include <string>
17
#include <vector>
18
#include <mutex>
19
#include "
swatdb_types.h
"
20
#include "
file.h
"
//for inheritance
21
22
class
BufferManager
;
23
class
HeapPage
;
24
class
HeapPageScanner
;
25
class
Schema
;
26
class
Record
;
27
31
class
HeapFile
;
32
37
struct
HeapFileHeader
{
38
42
PageNum
free
;
43
47
PageNum
full
;
48
52
std::uint32_t
free_size
;
53
57
std::uint32_t
full_size
;
58
62
std::uint64_t
num_records
;
63
};
64
71
class
HeapFile
:
public
File
{
72
73
friend
class
HeapFileScanner
;
74
75
public
:
76
90
HeapFile
(
Catalog
*catalog,
BufferManager
*
buf_mgr
,
Schema
*schema);
91
98
~HeapFile
() { }
99
112
void
createHeader();
113
125
void
flushHeader();
126
153
RecordId
insertRecord(
Record
record);
154
175
void
getRecord(
RecordId
record_id,
Record
* record);
176
205
void
updateRecord(
RecordId
record_id,
Record
record);
206
228
void
deleteRecord(
RecordId
record_id);
229
234
HeapFileHeader
getHeader();
235
236
private
:
237
262
void
_addPage(
HeapPage
* page,
PageId
page_id,
bool
full
);
287
void
_removePage(
HeapPage
* page,
PageId
page_id,
bool
full);
289
};
HeapFile::~HeapFile
~HeapFile()
HeapFile destructor.
Definition:
heapfile.h:98
PageNum
std::uint32_t PageNum
Definition:
swatdb_types.h:34
RecordId
Definition:
swatdb_types.h:66
HeapFileScanner
Definition:
heapfilescanner.h:31
HeapFileScanner::buf_mgr
BufferManager * buf_mgr
Definition:
heapfilescanner.h:82
HeapFileHeader::full_size
std::uint32_t full_size
Definition:
heapfile.h:57
file.h
Schema
Definition:
schema.h:27
HeapPage
Definition:
heappage.h:89
HeapFileHeader::num_records
std::uint64_t num_records
Definition:
heapfile.h:62
BufferManager
Definition:
bufmgr.h:248
HeapFileHeader::free_size
std::uint32_t free_size
Definition:
heapfile.h:52
HeapFileHeader
Definition:
heapfile.h:37
PageId
Definition:
swatdb_types.h:50
swatdb_types.h
HeapFileHeader::free
PageNum free
Definition:
heapfile.h:42
Record
Definition:
record.h:28
HeapFile
Definition:
heapfile.h:71
Catalog
Definition:
catalog.h:134
File
Definition:
file.h:43
HeapPageScanner
Definition:
heappagescanner.h:31
HeapFileHeader::full
PageNum full
Definition:
heapfile.h:47
Generated by
1.8.13