MCPcopy Create free account
hub / github.com/1345414527/MIT6.830 / DbFile

Interface DbFile

src/java/simpledb/storage/DbFile.java:19–96  ·  view source on GitHub ↗

The interface for database files on disk. Each table is represented by a single DbFile. DbFiles can fetch pages and iterate through tuples. Each file has a unique id used to store metadata about the table in the Catalog. DbFiles are generally accessed through the buffer pool, rather than directly by

Source from the content-addressed store, hash-verified

17 * by operators.
18 */
19public interface DbFile {
20 /**
21 * Read the specified page from disk.
22 *
23 * @throws IllegalArgumentException if the page does not exist in this file.
24 */
25 Page readPage(PageId id);
26
27 /**
28 * Push the specified page to disk.
29 *
30 * @param p The page to write. page.getId().pageno() specifies the offset into the file where the page should be written.
31 * @throws IOException if the write fails
32 *
33 */
34 void writePage(Page p) throws IOException;
35
36 /**
37 * Inserts the specified tuple to the file on behalf of transaction.
38 * This method will acquire a lock on the affected pages of the file, and
39 * may block until the lock can be acquired.
40 *
41 * @param tid The transaction performing the update
42 * @param t The tuple to add. This tuple should be updated to reflect that
43 * it is now stored in this file.
44 * @return An ArrayList contain the pages that were modified
45 * @throws DbException if the tuple cannot be added
46 * @throws IOException if the needed file can't be read/written
47 */
48 List<Page> insertTuple(TransactionId tid, Tuple t)
49 throws DbException, IOException, TransactionAbortedException;
50
51 /**
52 * Removes the specified tuple from the file on behalf of the specified
53 * transaction.
54 * This method will acquire a lock on the affected pages of the file, and
55 * may block until the lock can be acquired.
56 *
57 * @param tid The transaction performing the update
58 * @param t The tuple to delete. This tuple should be updated to reflect that
59 * it is no longer stored on any page.
60 * @return An ArrayList contain the pages that were modified
61 * @throws DbException if the tuple cannot be deleted or is not a member
62 * of the file
63 */
64 List<Page> deleteTuple(TransactionId tid, Tuple t)
65 throws DbException, IOException, TransactionAbortedException;
66
67 /**
68 * Returns an iterator over all the tuples stored in this DbFile. The
69 * iterator must use {@link BufferPool#getPage}, rather than
70 * {@link #readPage} to iterate through the pages.
71 *
72 * @return an iterator over all the tuples stored in this DbFile.
73 */
74 DbFileIterator iterator(TransactionId tid);
75
76 /**

Callers 50

getPageMethod · 0.95
readPageMethod · 0.65
readPageMethod · 0.65
readPageMethod · 0.65
readPageMethod · 0.65
TestFlushAllMethod · 0.65
setRightSiblingPtrsMethod · 0.65
setParentsMethod · 0.65
rollbackMethod · 0.95
recoverMethod · 0.95
recoverSearchMethod · 0.95
flushAllPagesMethod · 0.95

Implementers 3

SkeletonFiletest/simpledb/TestUtil.java
HeapFilesrc/java/simpledb/storage/HeapFile.jav
BTreeFilesrc/java/simpledb/index/BTreeFile.java

Calls

no outgoing calls

Tested by

no test coverage detected