RedBase page size = 4096 bytes - 4 = 4092 bytes (4K-8K is typical)
(1) (2) (3)
(a) (b) (c) (d) (e)
Question: Why do something different?
Simple record layout scheme:
More complex for:
General picture:
PF_Manager:: CreateFile DestroyFile OpenFile -> initialized "file handle" Close File AllocateBlock -> scratch memory page in buffer DisposeBlock
PF_FileHandle:: GetFirstPage -> initialized "page handle" GetLastPage -> " GetNextPage(n) -> " GetPrevPage(n) -> " GetThisPage(n) -> " AllocatePage -> " // All page fetches pin page automatically DisposePage(n) MarkDirty(n) UnpinPage(n) ForcePages(n)
PF_PageHandle:: GetData GetPageNum
Read document carefully!!
(return codes, error handling, statistics tracking, ...)
Also read the RedBase Logistics
document carefully
(getting code, makefiles, ...)
General picture:
File and page structure:
Managing free space
Record identifier (RID) = (page number, slot number)
RM_Manager:: CreateFile(record size) - set up header DestroyFile OpenFile -> initialized file handle (copy header) Close File
RM_FileHandle:: GetRec(RID) InsertRec(data) DeleteRec(RID) UpdateRec(data,RID) Also ForcePages(n)Diagram of record handling:
RM_Record:: GetData GetRid
RID:: GetPageNum GetSlotNum
RM_FileScan:: OpenScan(file, attr, comp, value, pin-hint) // File scan object is "scan handle", maintains state of scan GetNextRec CloseScan
Also read the RedBase Logistics
document carefully
(testing, submission, grading)