Question: 2 . 3 . Read and Write Methods. There are two types of read and write methods that have to be implemented: Methods with absolute

2.3. Read and Write Methods. There are two types of read and write methods that have to be implemented:
Methods with absolute addressing (e.g., readBlock) and methods that address relative to the current page of a file
(e.g., readNextBlock).
readBlock
The method reads the block at position pageNum from a file and stores its content in the memory pointed
to by the memPage page handle.
If the file has less than pageNum pages, the method should return RC_READ_NON_EXISTING_PAGE.
getBlockPos
Return the current page position in a file
readFirstBlock, readLastBlock
Read the first respective last page in a file
readPreviousBlock, readCurrentBlock, readNextBlock
Read the current, previous, or next page relative to the curPagePos of the file.
The curPagePos should be moved to the page that was read.
If the user tries to read a block before the first page or after the last page of the file, the method should
return RC_READ_NON_EXISTING_PAGE.
writeBlock, writeCurrentBlock
Write a page to disk using either the current position or an absolute position.
appendEmptyBlock
Increase the number of pages in the file by one. The new last page should be filled with zero bytes.
ensureCapacity
If the file has less than number0fPages pages then increase the size to number0fPages.
2.4. Return codes. The header file dberror.h defines several error codes as macros. As you may have noticed,
the storage manager functions all return an RC value. This value should indicate whether an operation was successful
and if not what type of error occurred. If a method call is successful, the function should return RC_OK. The
printError function can be used to output an error message based on a return code and the message stored in
global variable RC_message (implemented in dberror.c ).
Source Cone Structure
You source code directories should be structured as follows:
Put all source files in a folder assign1 in your git repository
This folder should contain at least
the provided header and C files
a make file for building your code Makefile. This makefile should create a binary from test_assign1
from test_assign1_1.c which requires dberror.c and all your C files implementing the storage_mgr.h
interface
a bunch of *.c and *.h files implementing the storage manager
README.txt : A text file that shortly describes your solution
Example, the structure may look like that:
git
assign 1
README. txt
dberror.c
dberror. h
storage_mgr a c
storage_mgr . h
test_assign1_1.c
test_helper.h
Makefile
 2.3. Read and Write Methods. There are two types of read

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!