class
#include <pinedb/storage.h>
StorageBackend This is an interface which represents a storage backend, this class is used to create, read and write pages to a physical storage.
Derived classes
- class DiskStorageBackend
Constructors, destructors, conversion operators
- ~StorageBackend() virtual
Public functions
-
auto create_new_page() -> page_
id_ type pure virtual -
auto read_page(page_
id_ type page_id, uint8_t* buffer) -> bool pure virtual -
auto write_page(page_
id_ type page_id, uint8_t* buffer) -> bool pure virtual -
auto delete_page(page_
id_ type page_id) -> bool pure virtual -
auto page_size() -> page_
size_ type pure virtual - auto close() -> bool pure virtual
- Closes the storage backend.
Function documentation
page_ id_ type pinedb:: StorageBackend:: create_new_page() pure virtual
Returns | If successful, page_id of the created page, otherwise -1 |
---|
This method creates a new page in the physical storage
bool pinedb:: StorageBackend:: read_page(page_ id_ type page_id,
uint8_t* buffer) pure 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:: StorageBackend:: write_page(page_ id_ type page_id,
uint8_t* buffer) pure 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:: StorageBackend:: delete_page(page_ id_ type page_id) pure 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:: StorageBackend:: page_size() pure virtual
Returns | The page size of this storage backend |
---|
bool pinedb:: StorageBackend:: close() pure virtual
Closes the storage backend.
Returns | true if the backend was closed / has been closed, false otherwise |
---|