Skip to content

Commit

Permalink
fix(p1): fix file header and comments (#694)
Browse files Browse the repository at this point in the history
* fix header and misleading comments

* update comments
  • Loading branch information
xx01cyx committed Jan 28, 2024
1 parent 1b40559 commit b6cc751
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions src/include/storage/disk/write_back_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
//
// BusTub
//
// cow_buffer.h
// write_back_cache.h
//
// Identification: src/include/storage/disk/cow_buffer.h
// Identification: src/include/storage/disk/write_back_cache.h
//
// Copyright (c) 2015-2023, Carnegie Mellon University Database Group
// Copyright (c) 2015-2024, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//

Expand All @@ -21,10 +21,10 @@
namespace bustub {

/**
* WriteBackCache provides extra memory space other than the buffer pool to store the copy-on-write pages.
* It's purpose is to gather the copy of pages that are about to be written back to disk, so that the bpm
* doesn't have to incur IO penality and wait for the write to be completed when evicting.
* Spring 24: The buffer is limited to store a constant number of pages in total (8).
* WriteBackCache provides extra memory space other than the buffer pool to store the pages. It's purpose
* is to gather the copy of pages that are about to be written back to disk, so that the bpm doesn't have
* to incur IO penality and wait for the write to be completed when evicting.
* Spring 24: The cache is limited to store a constant number of pages in total (8).
* !! ANY ATTEMPTS TO ADD ANOTHER IN-MEMORY CACHE WILL BE REVIEWED MANUALLY AS PER LEADERBOARD POLICY !!
*/
class WriteBackCache {
Expand All @@ -36,7 +36,7 @@ class WriteBackCache {
/**
* @brief Adds a new page to the write back cache.
* @param page the page pointer from the bpm that is about to be evicted.
* @return pointer to the copied page in the buffer, or nullptr if the buffer is full.
* @return pointer to the copied page in the cache, or nullptr if the cache is full.
*/
auto Add(Page *page) -> Page * {
if ((page == nullptr) || IsFull()) {
Expand All @@ -61,10 +61,10 @@ class WriteBackCache {
}

private:
/** @brief Whether the buffer is full. */
/** @brief Whether the cache is full. */
auto IsFull() -> bool { return free_slot_bitmap_ == 0xFFU; }

/** @brief Finds a free slot in the buffer, if not full. */
/** @brief Finds a free slot in the cache, if not full. */
auto FindFreeSlot() -> uint32_t {
BUSTUB_ASSERT(!IsFull(), "no free slot in write back cache");
uint32_t i = 0;
Expand Down
6 changes: 3 additions & 3 deletions test/storage/write_back_cache_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
//
// BusTub
//
// page_guard_test.cpp
// write_back_cache_test.cpp
//
// Identification: test/storage/page_guard_test.cpp
// Identification: test/storage/write_back_cache_test.cpp
//
// Copyright (c) 2015-2023, Carnegie Mellon University Database Group
// Copyright (c) 2015-2024, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//

Expand Down

0 comments on commit b6cc751

Please sign in to comment.