-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME
367 lines (324 loc) · 11.6 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
=====================================================================================
= 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.