diff options
author | Franciszek Malinka <franciszek.malinka@gmail.com> | 2022-11-06 22:22:03 +0100 |
---|---|---|
committer | Franciszek Malinka <franciszek.malinka@gmail.com> | 2022-11-06 22:55:50 +0100 |
commit | d79df21190dc5a6d042c74e2706e96936fc4a4d7 (patch) | |
tree | 2a09a4026b39bbbd68c717731cdfee447f39456b | |
parent | e43fada268e82f37d6527f3070c6f6909c894a6d (diff) |
Rebase with heappageheap-file
-rw-r--r-- | komfydb/storage/buffer_pool.cc | 2 | ||||
-rw-r--r-- | komfydb/storage/db_file.h | 8 | ||||
-rw-r--r-- | komfydb/storage/heap_file.cc | 3 | ||||
-rw-r--r-- | komfydb/storage/heap_page.cc | 2 |
4 files changed, 8 insertions, 7 deletions
diff --git a/komfydb/storage/buffer_pool.cc b/komfydb/storage/buffer_pool.cc index cd5a0d1..8451d0a 100644 --- a/komfydb/storage/buffer_pool.cc +++ b/komfydb/storage/buffer_pool.cc @@ -12,7 +12,7 @@ absl::StatusOr<Page*> BufferPool::GetPage(TransactionId tid, PageId pid, return absl::InvalidArgumentError("Cannot read another file to the pool"); } ASSIGN_OR_RETURN(DbFile * file, catalog->GetDatabaseFile(pid.GetTableId())); - page_pool[pid] = file->ReadPage(pid); + ASSIGN_OR_RETURN(page_pool[pid], file->ReadPage(pid)); } return page_pool.at(pid).get(); diff --git a/komfydb/storage/db_file.h b/komfydb/storage/db_file.h index b169bb4..53298b2 100644 --- a/komfydb/storage/db_file.h +++ b/komfydb/storage/db_file.h @@ -24,9 +24,9 @@ namespace komfydb::storage { class DbFile { public: - virtual ~DbFile() = 0; + virtual ~DbFile(){}; - virtual absl::StatusOr<std::unique_ptr<Page>> ReadPage(PageId id); + virtual absl::StatusOr<std::unique_ptr<Page>> ReadPage(PageId id) = 0; // Not necessary for Lab 1 // virtual absl::Status WritePage(Page* p?); @@ -40,10 +40,10 @@ class DbFile { // TODO This method shouldn't be here for sure.. // virtual std::unique_ptr<DbFileIterator> Iterator(TransactionId tid); - virtual uint32_t GetId(); + virtual uint32_t GetId() = 0; // TODO Shouldn't this return a const pointer? - virtual TupleDesc* GetTupleDesc(); + virtual TupleDesc* GetTupleDesc() = 0; }; }; // namespace komfydb::storage diff --git a/komfydb/storage/heap_file.cc b/komfydb/storage/heap_file.cc index 15ce027..078506d 100644 --- a/komfydb/storage/heap_file.cc +++ b/komfydb/storage/heap_file.cc @@ -41,7 +41,8 @@ absl::StatusOr<std::unique_ptr<HeapFile>> HeapFile::Create( return absl::InvalidArgumentError("File size not divisble by page size."); } - return std::make_unique<HeapFile>(file, td, ++table_cnt, permissions); + return std::unique_ptr<HeapFile>( + new HeapFile(file, td, ++table_cnt, permissions)); } std::fstream& HeapFile::GetFile() { diff --git a/komfydb/storage/heap_page.cc b/komfydb/storage/heap_page.cc index 4dab055..2c99b98 100644 --- a/komfydb/storage/heap_page.cc +++ b/komfydb/storage/heap_page.cc @@ -126,4 +126,4 @@ absl::Status HeapPage::SetBeforeImage() { return absl::OkStatus(); } -}; // namespace komfydb::storage
\ No newline at end of file +}; // namespace komfydb::storage |