|
smollerGraph 0.20.2
A small graph database, from scratch
|
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. | |
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.
| 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.
| 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.
|
inline |
Definition at line 41 of file token_store.h.
|
inline |
Returns the name token stands for, or nothing for kNoToken.
Definition at line 51 of file token_store.h.
| 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.
| absl::Status smollergraph::TokenStore::OpenTemporary | ( | ) |
Definition at line 18 of file token_store.cc.
|
inline |
Definition at line 42 of file token_store.h.
|
inline |
Definition at line 43 of file token_store.h.
|
staticconstexpr |
The longest name a token can stand for.
Definition at line 36 of file token_store.h.