Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Google Analytics 4 The Data Driven Marketing Revolution

Authors: Galen Poll

2024th Edition

B0CRK92F5F, 979-8873956234

More Books

Students also viewed these Databases questions

Question

Discuss the techniques of job analysis.

Answered: 1 week ago

Question

How do we do subnetting in IPv6?Explain with a suitable example.

Answered: 1 week ago

Question

Explain the guideline for job description.

Answered: 1 week ago

Question

What is job description ? State the uses of job description.

Answered: 1 week ago

Question

What are the objectives of job evaluation ?

Answered: 1 week ago