|
smollerGraph 0.20.2
A small graph database, from scratch
|
A file of fixed-size records, packed into pages after a header page, which holds how many records there are. More...
#include <record_file.h>
Public Member Functions | |
| absl::Status | Open (const std::string &path) |
| Opening another file writes back the changes to the one that was open. | |
| absl::Status | OpenTemporary () |
| void | Flush () |
| Writes the changed pages to the file. | |
| uint32_t | count () const |
| uint64_t | page_reads () const |
| uint64_t | page_writes () const |
| Record | Read (uint32_t id) const |
Reads record id, which has to be below count(). | |
| void | Write (uint32_t id, const Record &record) |
| uint32_t | Append (const Record &record) |
| Adds a record after the last one, and returns its id. | |
Static Public Member Functions | |
| static PageId | PageOf (uint32_t id) |
| Page 0 is the header, so the records start on page 1. | |
| static size_t | OffsetOf (uint32_t id) |
Static Public Attributes | |
| static constexpr uint32_t | kPerPage = kPageSize / sizeof(Record) |
| static constexpr size_t | kPoolPages = 16384 |
| The most pages the pool keeps in memory, 64 MiB of them, which holds the million relationships we benchmark. | |
A file of fixed-size records, packed into pages after a header page, which holds how many records there are.
A record's id says which page it's on and where, so finding one needs no search. Its pages go through a buffer pool, which writes the changed ones to the file when it needs their frames, or when it's flushed or closed.
Definition at line 22 of file record_file.h.
|
inline |
Adds a record after the last one, and returns its id.
Definition at line 76 of file record_file.h.
|
inline |
Definition at line 52 of file record_file.h.
|
inline |
Writes the changed pages to the file.
Definition at line 50 of file record_file.h.
|
inlinestatic |
Definition at line 58 of file record_file.h.
|
inline |
Opening another file writes back the changes to the one that was open.
Definition at line 33 of file record_file.h.
|
inline |
Definition at line 41 of file record_file.h.
|
inline |
Definition at line 53 of file record_file.h.
|
inline |
Definition at line 54 of file record_file.h.
|
inlinestatic |
Page 0 is the header, so the records start on page 1.
Definition at line 57 of file record_file.h.
|
inline |
Reads record id, which has to be below count().
Definition at line 63 of file record_file.h.
|
inline |
Definition at line 70 of file record_file.h.
|
staticconstexpr |
Definition at line 27 of file record_file.h.
|
staticconstexpr |
The most pages the pool keeps in memory, 64 MiB of them, which holds the million relationships we benchmark.
Definition at line 30 of file record_file.h.