Question: Task The goal of this assignment is to implement a simple storage manager - a module that is capable of reading blocks from a file

Task
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. The storage manager deals with
pages (blocks) of fixed size (PAGE_SIZE). In addition to reading and writing pages from a file, it provides methods for
creating, opening, and closing files. The storage manager has to maintain several types of information for an open
file: The number of total pages in the file, the current page position (for reading and writing), the file name, and a
POSIX file descriptor or FILE pointer. In your implementation you should implement the interface described below.
Please commit a text file README. txt that (shortly) describes the ideas behind your solution and the code structure.
Comment your code!
INTERFACE
The interface your storage manager should implement is given as a header file storage_mgr.h. The content of this
header is shown below. Two additional headers
and test_helpers.h define error codes and constants
and macros used in the test cases.
#ifndef STORAGE_MGR_H
#define STORAGE_MGR_H
#include "dberror.h"
??************************************************************************************************************************
handle data structures
************************************************************************************************************************?
typedef struct SM_FileHandle {
char * fileName;
int totalNumPages;
int curPagePos;
void *mgmtInfo;
} SM_FileHandle;
typedef char * SM_PageHandle;
??************************************************************************************************************************
, interface
************************************************************************************************************************?
/* manipulating page files */
extern void initStorageManager (void);
extern RC createPageFile (char * fileName);
extern RC openPageFile (char *fileName, SM_FileHandle *fHandle);
extern RC closePageFile (SM_FileHandle *fHandle);
extern RC destroyPageFile (char * fileName);
/* reading blocks from disc */
extern RC readBlock (int pageNum, SM_FileHandle *fHandle, SM_PageHandle memPage);
extern int getBlockPos (SM_FileHandle *fHandle);
extern RC readFirstBlock (SM_FileHandle *fHandle, SM_PageHandle memPage);
extern RC readPreviousBlock (SM_FileHandle *fHandle, SM_PageHandle memPage);
extern RC readCurrentBlock (SM_FileHandle *fHandle, SM_PageHandle memPage);
extern RC readNextBlock (SM_FileHandle *fHandle, SM_PageHandle memPage);
extern RC readLastBlock (SM_FileHandle *fHandle, SM_PageHandle memPage);
/* writing blocks to a page file */
extern RC writeBlock (int pageNum, SM_FileHandle *fHandle, SM_PageHandle memPage);
extern RC writeCurrentBlock (SM_FileHandle *fHandle, SM_PageHandle memPage);
extern RC appendEmptyBlock (SM_FileHandle *fHandle);
extern RC ensureCapacity (int number0fPages, SM_FileHandle *fHandle);
#endif
 Task The goal of this assignment is to implement a simple

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!