smollerGraph 0.20.2
A small graph database, from scratch
Loading...
Searching...
No Matches
smollergraph::Pager Class Reference

A file of pages, each read and written whole, by its number. More...

#include <pager.h>

Public Member Functions

 Pager ()=default
 
 ~Pager ()
 
 Pager (const Pager &)=delete
 
Pager & operator= (const Pager &)=delete
 
absl::Status Open (const std::string &path)
 Opens the file at path, creating it when it isn't there.
 
absl::Status OpenTemporary ()
 Opens a file with no name, which is deleted once it's closed.
 
PageId page_count () const
 
void Read (PageId id, Page &page) const
 Reads page id, which has to be below page_count().
 
void Write (PageId id, const Page &page)
 Writes page id. Writing the page at page_count() adds it to the file.
 
uint64_t reads () const
 How many pages this pager has read and written since it opened.
 
uint64_t writes () const
 

Detailed Description

A file of pages, each read and written whole, by its number.

Definition at line 23 of file pager.h.

Constructor & Destructor Documentation

◆ Pager() [1/2]

smollergraph::Pager::Pager ( )
default

◆ ~Pager()

smollergraph::Pager::~Pager ( )

Definition at line 28 of file pager.cc.

◆ Pager() [2/2]

smollergraph::Pager::Pager ( const Pager &  )
delete

Member Function Documentation

◆ Open()

absl::Status smollergraph::Pager::Open ( const std::string &  path)

Opens the file at path, creating it when it isn't there.

Definition at line 32 of file pager.cc.

◆ OpenTemporary()

absl::Status smollergraph::Pager::OpenTemporary ( )

Opens a file with no name, which is deleted once it's closed.

Definition at line 36 of file pager.cc.

◆ operator=()

Pager & smollergraph::Pager::operator= ( const Pager &  )
delete

◆ page_count()

PageId smollergraph::Pager::page_count ( ) const
inline

Definition at line 35 of file pager.h.

◆ Read()

void smollergraph::Pager::Read ( PageId  id,
Page &  page 
) const

Reads page id, which has to be below page_count().

Definition at line 59 of file pager.cc.

◆ reads()

uint64_t smollergraph::Pager::reads ( ) const
inline

How many pages this pager has read and written since it opened.

Definition at line 42 of file pager.h.

◆ Write()

void smollergraph::Pager::Write ( PageId  id,
const Page &  page 
)

Writes page id. Writing the page at page_count() adds it to the file.

Definition at line 68 of file pager.cc.

◆ writes()

uint64_t smollergraph::Pager::writes ( ) const
inline

Definition at line 43 of file pager.h.


The documentation for this class was generated from the following files: