This is the relational SQL database build with node.js
Part 1- Storage Manager The goal of this assignment is to implement a simple storage manager - a module that is capable of reading blocks from a file on disk into memory and writing blocks from memory to a file on disk.
Part 2- Buffer Manager The goal of this assignment is to implement a buffer manager which manages a fixed number of pages in memory that represent pages from a page file managed by the storage manager.The Buffer manager should be able to handle more than one open buffer pool at the same time or one open buffer pool for each page file. FIFO and LRU replacement strategy implementations are required.
Part 3- Record Manager The goal of this assignment is to implement a record manager which could handle tables with a fixed schema. The implementations of insertion, deletion, update and scan operation are required.
#Members:
- Fangzhou Xiong A20376382 fxiong4@hawk.iit.edu
- Zhiquan Li A20381063 zli175@hawk.iit.edu
- Guangda Li A20360157 gli32@hawk.iit.edu
#Instruction of running program:
- unpack the zip file to local
- direct to the
- run command: npm install mocha -g
- To run the test case, run command: mocha I.E direct into the root dir of the project you should run : mocha ./test/test_assign3_1.js
#dependency ./package.json
#layout ./src/DBErrors.js command defined DBErrors ./src/Constants.js Constants variable class ./src/BM Buffer manager ./src/RM Record Manager ./src/SM Storage Manger
#API --StorageManager
-
initStorageManager Initialize the StorageManager.
-
createPageFile Create a file
-
openPageFile Open the file and store file information into file object.
-
closePageFile Close the file.
-
destroyPageFile Delete the file.
-
readBlock Read a block of data from file on disk into memory
-
readFirstBlock Read the first block from file on disk into memory
-
readPreviousBlock Read the previous block from file on disk into memory
-
readCurrentBlock Read the current block from file on disk into memory
-
readNextBlock Read the next block from file on disk into memory
-
readLastBlock Read the last block from file on disk into memory
-
writeBlock Write a block from memory to the file
-
writeCurrentBlock Write a block from memory to the file of current position.
-
appendEmptyBlock Write an empty block at the end of the file.
-
ensureCapacity If the totalPageNumber is less than numberOfPages then add pages until it equals to the numberOfPages.
--BufferManager
-
initBufferPool: initialize buffer pool
-
shutdownBufferPool: shut down buffer pool
-
forceFlushPool: write data of all dirty pages in buffer pool back page file
-
markDirty: Mark a page dirty
-
unpinPage: unpin a page
-
forcePage: write data of a page in buffer pool back page file
-
pinPage: pin a page
-
getDirtyFlags: return all dirty page number
-
getFixCounts: return fixcount
-
getNumReadIO: return the number of pages read from page file
-
getNumWriteIO: return the number of pages write into page file
-
FIFO: FIFO replacement strategy
-
LRU: LRU replacement strategy
--RecordManager
-
initRecordManager: Initialize the Record Manager with a given entry to the buffer manager
-
shutdownRecordManager: Shut down the Record Manager
-
initTableInfoPage: Initialize table info page
-
createTable: Create table file with given name and schema
-
openTable: Open table
-
closeTable: Close table
-
deleteTable: Delete table
-
getNumTuples: Get total number of tuples in table
-
insertRecord: Insert records into table
-
deleteRecord: Delete records from table
-
updateRecord: Update records
-
getRecord: Return Records
-
startScan: Scan all the tuple in table with given condition
-
next: Give an next eligble record in table
-
closeScan: Clost scan
-
getRecordSize: Get size of each record
-
createSchema: Create schema with given value
-
freeSchema: Unset schema
-
createRecord: Create empty record with given schema
-
freeRecord: Unset record
-
getAttr: Get the value of requested attribute
-
setAttr: Update the value of requested attribute