-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Description:
This issue involves creating a generic TableFile<TRecord> abstraction that provides a logical view of a table stored on disk, acting as the primary interface for managing and accessing records for a specific table type (e.g., TableFile<Grape>). This abstraction will sit above the BufferManager, requesting pages as needed and interpreting their contents as collections of TRecord instances.
Core Responsibilities:
- Table-to-File Mapping: Define a clear convention for how each table (e.g.,
Uva,Vinho,País) maps to a specific file on disk (e.g.,Uva.tbl,Vinho.tbl,Pais.tbl). [cite_start]This implementation must disregard the use of SGBDs and use only the operating system's file system. - Page Management: The
TableFilewill not directly perform file I/O but will orchestrate it by calling theBufferManager'sGetPage()andUnpinPage()methods for each page it needs to access or modify. - Record Access: Provide methods to:
GetPageRecords(pageId): Retrieve a specific page via theBufferManagerand deserialize allTRecordinstances contained within that page.AddRecord(TRecord record): Serialize a new record, find space (potentially on a new page), add it, mark the page dirty, and unpin.GetAllRecords(): An iterator or method to sequentially read all pages of the table using theBufferManagerand yield allTRecordinstances.
- Metadata Management: Store and retrieve table-specific metadata, such as the total number of pages currently allocated to the table, and potentially the schema information (e.g., number of columns, column types) if not implicitly handled by
TRecord. This metadata might be stored in a header page or a separate metadata file for the table. - Record Packing/Unpacking: Leverage the serialization/deserialization logic developed in Issue 1.2 to convert between raw page data and
TRecordobjects.
Considerations:
Efficiently finding space for new records and handling page overflow (if a page becomes full) will be key. The TableFile should ensure proper pinning and unpinning of pages to avoid deadlocks or premature eviction.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels