diff --git a/src/include/storage/disk/disk_scheduler.h b/src/include/storage/disk/disk_scheduler.h index b347c3f86..16deb356d 100644 --- a/src/include/storage/disk/disk_scheduler.h +++ b/src/include/storage/disk/disk_scheduler.h @@ -73,6 +73,16 @@ class DiskScheduler { */ void StartWorkerThread(); + using DiskSchedulerPromise = std::promise; + + /** + * @brief Create a Promise object. If you want to implement your own version of promise, you can change this function + * so that our test cases can use your promise implementation. + * + * @return std::promise + */ + auto CreatePromise() -> DiskSchedulerPromise { return {}; }; + private: /** Pointer to the disk manager. */ DiskManager *disk_manager_ __attribute__((__unused__)); diff --git a/test/storage/disk_scheduler_test.cpp b/test/storage/disk_scheduler_test.cpp index d33245502..749cebc8b 100644 --- a/test/storage/disk_scheduler_test.cpp +++ b/test/storage/disk_scheduler_test.cpp @@ -33,9 +33,9 @@ TEST(DiskSchedulerTest, DISABLED_ScheduleWriteReadPageTest) { std::strncpy(data, "A test string.", sizeof(data)); - std::promise promise1; + auto promise1 = disk_scheduler->CreatePromise(); auto future1 = promise1.get_future(); - std::promise promise2; + auto promise2 = disk_scheduler->CreatePromise(); auto future2 = promise2.get_future(); disk_scheduler->Schedule({/*is_write=*/true, reinterpret_cast(&data), /*page_id=*/0, promise1});