tcw007 / 525-PA1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

=====================================================================================
=                   525 Programming Assignment 1 README file                        = 
=====================================================================================
                    1. Personnel information

xwu64@hawk.iit.edu      20354020    Xiaoliang Wu (representative)
zliu92@hawk.iit.edu     20355209    Zhipeng Liu
xyang76@hawk.iit.edu    20352628    Xincheng Yang
ctu5@hawk.iit.hawk      20352609    Chuanwei Tu

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    2. File list 

  dberror.c
  dberror.h
  Makefile
  README
  storage_mgr.c
  storage_mgr.h
  test_assign1_1.c
  test_assign1_2.c
  test_helper.h

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    3. Milestone

  2016/02/07 all function have pass test.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    4. Installation instruction 

  using test_assign1_1.c test:
    $ make test1
    $ ./test1

  using test_assign1_2.c test:
    $ make test2
    $ ./test2

  after test, use clean to delete files except source code.
    $ make clean

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    5. Function descriptions: of all additional functions 



/***************************************************************
 * Function Name: initStorageManager
 * 
 * Description:to let user know enter the StorageManager
 *
 * Parameters:void
 *
 * Return:void
 *
 * Author:Chuanwei Tu
 *
 * History:
 *      Date            Name                        Content
 *      2016/2/1    	 Chuanwei Tu				  initializing the Storage Manager 
 *
***************************************************************/

/***************************************************************
 * Function Name: createPageFile
 * 
 * Description: Create a new page file fileName. The initial file size should be one page. This method should fill this single page with '\0' bytes.
 *
 * Parameters: char *fileName
 *
 * Return: RC
 *
 * Author: Xiaoliang Wu
 *
 * History:
 *      Date            Name                        Content
 *      --------------  --------------------------  ----------------
 *      2016/02/07      Xiaoliang Wu                implement function
 *
***************************************************************/

/***************************************************************
 * Function Name: openPageFile
 * 
 * Description: Opens an existing page file.
 *
 * Parameters:char *fileName ,SM_FileHandle *fHandle
 *
 * Return: RC
 *
 * Author: Xiaoliang Wu
 *
 * History:
 *      Date            Name                        Content
 *      2016/02/07      Xiaoliang Wu                implement function
 *
***************************************************************/

/***************************************************************
 * Function Name: closePageFile
 * 
 * Description: Close an open page file
 *
 * Parameters: SM_FileHandle *fHandle
 *
 * Return: RC
 *
 * Author: Xiaoliang Wu
 *
 * History:
 *      Date            Name                        Content
 *      2016/02/07      Xiaoliang Wu                implement function
 *
***************************************************************/

/***************************************************************
 * Function Name: destroyPageFile
 * 
 * Description: destroy (delete) a page file
 *
 * Parameters: SM_FileHandle *fHandle
 *
 * Return: RC
 *
 * Author: Xiaoliang Wu 
 *
 * History:
 *      Date            Name                        Content
 *      2016/02/07      Xiaoliang Wu                implement function
 *
***************************************************************/

/***************************************************************
 * Function Name: readBlock
 * 
 * Description: read the pageNum block from the file defined by fHandle into address memPage
 *
 * Parameters:int pageNum, SM_FileHandle *fHandle, SM_PageHandle memPage
 *
 * Return:RC
 *
 * Author:Zhipeng Liu
 *
 * History:
 *      Date            Name                        Content
 *      2016/1/30      Zhipeng Liu            first time to implement the function
 *
***************************************************************/

/***************************************************************
 * Function Name: getBlockPos
 * 
 * Description:return the current block position in the file
 *
 * Parameters:SM_FileHandle *fHandle
 *
 * Return: RC
 *
 * Author:Zhipeng Liu
 *
 * History:
 *      Date            Name                        Content
 *      2016/1/30      Zhipeng Liu            first time to implement the function
 *
***************************************************************/

/***************************************************************
 * Function Name:  readFirstBlock
 * 
 * Description:read the first block of the file described in fHandle
 *
 * Parameters:SM_FileHandle *fHandle, SM_PageHandle memPage
 *
 * Return:RC
 *
 * Author:Zhipeng Liu
 *
 * History:
 *      Date                     Name                        Content
 *      2016/1/30      Zhipeng Liu                    first time to implement the function
 *
***************************************************************/

/***************************************************************
 * Function Name:readPreviousBlock
 * 
 * Description:read the previousblock in this file into the address witch memPage pointed
 *
 * Parameters:SM_FileHandle *fHandle, SM_PageHandle memPage
 *
 * Return:RC
 *
 * Author:Zhipeng Liu
 *
 * History:
 *      Date                     Name                             Content
 *      2016/1/27       Zhipeng Liu                    first time to implement the function
 *
***************************************************************/

/***************************************************************
 * Function Name: readCurrentBlock
 * 
 * Description: read the current block (pointed by the fHandle->curPagePos) into memo address memPage
 *
 * Parameters: SM_FileHandle *fHandle, SM_PageHandle memPage
 *
 * Return: RC
 *
 * Author: Zhipeng Liu
 *
 * History:
 *      Date            Name                        Content
 *   2016/1/27     Zhipeng Liu             first time to implement the function
 *
***************************************************************/

/***************************************************************
 * Function Name: readNextBlock
 * 
 * Description: read the next block (the current block defined in the fHandle->curPagePos) in to memo address memPage
 *
 * Parameters: SM_FileHandle *fHandle, SM_PageHandle memPage
 *
 * Return: RC
 *
 * Author: Zhipeng Liu
 *
 * History:
 *      Date            Name                        Content
 *   2016/1/27     Zhipeng Liu             first time to implement the function
 *
***************************************************************/

/***************************************************************
 * Function Name: readLastBlock
 * 
 * Description: read the last block in this file into memo address memPage
 *
 * Parameters: SM_FileHandle *fHandle, SM_PageHandle memPage
 *
 * Return: RC
 *
 * Author: Zhipeng Liu
 *
 * History:
 *      Date            Name                        Content
 *   2016/1/27     Zhipeng Liu             first time to implement the function
 *
***************************************************************/

/***************************************************************
 * Function Name: writeBlock 
 * 
 * Description: Write a page to disk using either the current position or an absolute position.
 *
 * Parameters: int numberOfPages, SM_FileHandle *fHandle
 *
 * Return: RC
 *
 * Author: Xincheng Yang
 *
 * History:
 *      Date            Name                        Content
 *   2016/2/2		Xincheng Yang             first time to implement the function
 *   2016/2/2		Xincheng Yang			  modified some codes
 *
***************************************************************/

/***************************************************************
 * Function Name: writeCurrentBlock 
 * 
 * Description: Write a page to disk using either the current position or an absolute position.
 *
 * Parameters: int numberOfPages, SM_FileHandle *fHandle
 *
 * Return: RC
 *
 * Author: Xincheng Yang
 *
 * History:
 *      Date            Name                        Content
 *   2016/2/2		Xincheng Yang             first time to implement the function
 *
***************************************************************/

/***************************************************************
 * Function Name: appendEmptyBlock 
 * 
 * Description: Increase the number of pages in the file by one. The new last page should be filled with zero bytes.
 *
 * Parameters: int numberOfPages, SM_FileHandle *fHandle
 *
 * Return: RC
 *
 * Author: Xincheng Yang
 *
 * History:
 *      Date            Name                        Content
 *   2016/2/1		Xincheng Yang             first time to implement the function
 *   2016/2/2		Xincheng Yang			  modified some codes
 *
***************************************************************/

/***************************************************************
 * Function Name: ensureCapacity 
 * 
 * Description: If the file has less than numberOfPages pages then increase the size to numberOfPages.
 *
 * Parameters: int numberOfPages, SM_FileHandle *fHandle
 *
 * Return: RC
 *
 * Author: Xincheng Yang
 *
 * History:
 *      Date            Name                        Content
 *   2016/2/1		Xincheng Yang             first time to implement the function
 *
***************************************************************/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    6. Additional error codes: of all additional error codes 


  RC_CREATE_FILE_FAIL 
  Unkown reasons that cause creating file fail.

  RC_GET_NUMBER_OF_BYTES_FAILED 
  Unkown reasons that cause program cannot get size of file when program open file.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    7. Data structure: main data structure used

  No additional data structure are used.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    8. Extra credit: of all extra credits 

  There are additional tests that are implemented in test_assign1_2.c. In this test, it test all functions that are not tested in test_assign1_1.c.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    9. Additional files: of all additional files 

  No additional files.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    10. Test cases: of all additional test cases added 

  test case in test_assign1_1.c
    testCreateOpenClose()
        test createPageFile, openPageFile, closePageFile, destroyPageFile functions.

    testSinglePageContent()
        test createPageFile, openPageFile, readFirstBlock, writeBlock, readFirstBlock, destroyPageFile, functions.

  test case in test_assign1_2.c
    testRestFunc()
        test createPageFile, openPageFile, readFirstBlock, writeBlock, getBlockPos, readPreviousBlock, readCurrentBlock, readNextBlock, appendEmptyBlock, readLastBlock, writeCurrentBlock, ensureCapacity, destroyPageFile, functions.
        
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    11. Problems solved 


  Implement all required functions and additional test case.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    12. Problems to be solved

  This program could be optimized.

About


Languages

Language:C 98.4%Language:Makefile 1.6%