pinedb::DiskStorageBackend class

Base classes

class StorageBackend

Constructors, destructors, conversion operators

DiskStorageBackend(const std::string& file_path, page_size_type page_sz)
~DiskStorageBackend()

Public functions

auto create_new_page() -> page_id_type virtual
auto read_page(page_id_type page_id, uint8_t* buffer) -> bool virtual
auto write_page(page_id_type page_id, uint8_t* buffer) -> bool virtual
auto delete_page(page_id_type page_id) -> bool virtual
auto page_size() -> page_size_type virtual
auto close() -> bool virtual
Closes the storage backend.

Function documentation

page_id_type pinedb::DiskStorageBackend::create_new_page() virtual

Returns If successful, page_id of the created page, otherwise -1

This method creates a new page in the physical storage

bool pinedb::DiskStorageBackend::read_page(page_id_type page_id, uint8_t* buffer) virtual

Parameters
page_id id of the page to be read
buffer A buffer of size atleast equal to page_size, which is used to hold the page data
Returns true if the read was successful, false otherwise

This method reads a page from the storage and copies its contents to the passed buffer

bool pinedb::DiskStorageBackend::write_page(page_id_type page_id, uint8_t* buffer) virtual

Parameters
page_id id of the page to be written
buffer A buffer of size atleast equal to page_size, which is used to hold the page data
Returns true if the write was successful, false otherwise

This method writes a page to the storage and copies the contents of the buffer

bool pinedb::DiskStorageBackend::delete_page(page_id_type page_id) virtual

Parameters
page_id id of the page to be deleted
Returns true if the delete was successful, false otherwise

This method deletes a page, and frees the storage associated with the page

page_size_type pinedb::DiskStorageBackend::page_size() virtual

Returns The page size of this storage backend

bool pinedb::DiskStorageBackend::close() virtual

Closes the storage backend.

Returns true if the backend was closed / has been closed, false otherwise