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

Names and the tokens that stand for them, kept in a file of records, and in memory both ways, as there are only a few of them. More...

#include <token_store.h>

Public Member Functions

absl::Status Open (const std::string &path)
 Opens the store in the file at path, creating it when it isn't there.
 
absl::Status OpenTemporary ()
 
void Flush ()
 
uint64_t page_reads () const
 
uint64_t page_writes () const
 
TokenId Add (std::string_view name)
 Returns the token for name, adding it the first time.
 
std::optional< TokenId > Find (std::string_view name) const
 Returns the token for name, if the store has one.
 
std::string Name (TokenId token) const
 Returns the name token stands for, or nothing for kNoToken.
 

Static Public Attributes

static constexpr size_t kMaxName = sizeof(TokenRecord::name) - 1
 The longest name a token can stand for.
 

Detailed Description

Names and the tokens that stand for them, kept in a file of records, and in memory both ways, as there are only a few of them.

Neo4j keeps its labels and relationship types in stores like this one.

Definition at line 33 of file token_store.h.

Member Function Documentation

◆ Add()

TokenId smollergraph::TokenStore::Add ( std::string_view  name)

Returns the token for name, adding it the first time.

The name has to be at most kMaxName bytes long.

Definition at line 33 of file token_store.cc.

◆ Find()

std::optional< TokenId > smollergraph::TokenStore::Find ( std::string_view  name) const

Returns the token for name, if the store has one.

Definition at line 44 of file token_store.cc.

◆ Flush()

void smollergraph::TokenStore::Flush ( )
inline

Definition at line 41 of file token_store.h.

◆ Name()

std::string smollergraph::TokenStore::Name ( TokenId  token) const
inline

Returns the name token stands for, or nothing for kNoToken.

Definition at line 51 of file token_store.h.

◆ Open()

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

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

Definition at line 12 of file token_store.cc.

◆ OpenTemporary()

absl::Status smollergraph::TokenStore::OpenTemporary ( )

Definition at line 18 of file token_store.cc.

◆ page_reads()

uint64_t smollergraph::TokenStore::page_reads ( ) const
inline

Definition at line 42 of file token_store.h.

◆ page_writes()

uint64_t smollergraph::TokenStore::page_writes ( ) const
inline

Definition at line 43 of file token_store.h.

Member Data Documentation

◆ kMaxName

constexpr size_t smollergraph::TokenStore::kMaxName = sizeof(TokenRecord::name) - 1
staticconstexpr

The longest name a token can stand for.

Definition at line 36 of file token_store.h.


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