2
2
//
3
3
// BusTub
4
4
//
5
- // cow_buffer .h
5
+ // write_back_cache .h
6
6
//
7
- // Identification: src/include/storage/disk/cow_buffer .h
7
+ // Identification: src/include/storage/disk/write_back_cache .h
8
8
//
9
- // Copyright (c) 2015-2023 , Carnegie Mellon University Database Group
9
+ // Copyright (c) 2015-2024 , Carnegie Mellon University Database Group
10
10
//
11
11
// ===----------------------------------------------------------------------===//
12
12
21
21
namespace bustub {
22
22
23
23
/* *
24
- * WriteBackCache provides extra memory space other than the buffer pool to store the copy-on-write pages.
25
- * It's purpose is to gather the copy of pages that are about to be written back to disk, so that the bpm
26
- * doesn't have to incur IO penality and wait for the write to be completed when evicting.
27
- * Spring 24: The buffer is limited to store a constant number of pages in total (8).
24
+ * WriteBackCache provides extra memory space other than the buffer pool to store the pages. It's purpose
25
+ * is to gather the copy of pages that are about to be written back to disk, so that the bpm doesn't have
26
+ * to incur IO penality and wait for the write to be completed when evicting.
27
+ * Spring 24: The cache is limited to store a constant number of pages in total (8).
28
28
* !! ANY ATTEMPTS TO ADD ANOTHER IN-MEMORY CACHE WILL BE REVIEWED MANUALLY AS PER LEADERBOARD POLICY !!
29
29
*/
30
30
class WriteBackCache {
@@ -36,7 +36,7 @@ class WriteBackCache {
36
36
/* *
37
37
* @brief Adds a new page to the write back cache.
38
38
* @param page the page pointer from the bpm that is about to be evicted.
39
- * @return pointer to the copied page in the buffer , or nullptr if the buffer is full.
39
+ * @return pointer to the copied page in the cache , or nullptr if the cache is full.
40
40
*/
41
41
auto Add (Page *page) -> Page * {
42
42
if ((page == nullptr ) || IsFull ()) {
@@ -61,10 +61,10 @@ class WriteBackCache {
61
61
}
62
62
63
63
private:
64
- /* * @brief Whether the buffer is full. */
64
+ /* * @brief Whether the cache is full. */
65
65
auto IsFull () -> bool { return free_slot_bitmap_ == 0xFFU ; }
66
66
67
- /* * @brief Finds a free slot in the buffer , if not full. */
67
+ /* * @brief Finds a free slot in the cache , if not full. */
68
68
auto FindFreeSlot () -> uint32_t {
69
69
BUSTUB_ASSERT (!IsFull (), " no free slot in write back cache" );
70
70
uint32_t i = 0 ;
0 commit comments