|
vkdb
A time series database engine in C++.
|
In-memory table for storing key-value pairs. More...
#include <mem_table.h>
Public Types | |
| using | key_type = TimeSeriesKey |
| using | mapped_type = std::optional<TValue> |
| using | value_type = std::pair<const key_type, mapped_type> |
| using | size_type = uint64_t |
| using | table_type = std::map<const key_type, mapped_type> |
Public Member Functions | |
| MemTable () noexcept=default | |
| Construct a new MemTable object. | |
| MemTable (table_type &&entries) noexcept | |
| Construct a new MemTable object from a map of entries. | |
| MemTable (MemTable &&) noexcept=default | |
| Move-construct a MemTable object. | |
| MemTable & | operator= (MemTable &&) noexcept=default |
| Move-assign a MemTable object. | |
| MemTable (const MemTable &)=delete | |
| Deleted copy constructor. | |
| MemTable & | operator= (const MemTable &)=delete |
| Deleted copy assignment operator. | |
| ~MemTable () noexcept=default | |
| Destroy the MemTable object. | |
| void | put (const key_type &key, const mapped_type &value) |
| Inserts or updates a key-value pair in the table. | |
| bool | contains (const key_type &key) const noexcept |
| Checks if the table contains a key. | |
| mapped_type | get (const key_type &key) const |
| Retrieves the value associated with a key. | |
| std::vector< value_type > | getRange (const key_type &start, const key_type &end) const |
| Retrieves a range of key-value pairs. | |
| void | clear () noexcept |
| Clears the table. | |
| table_type | table () const noexcept |
| Returns the table. | |
| size_type | size () const noexcept |
| Returns the size of the table. | |
| bool | empty () const noexcept |
| Checks if the table is empty. | |
| std::string | str () const noexcept |
| Converts the table to a string representation. | |
Static Public Member Functions | |
| static void | fromString (const std::string &str, MemTable &table) |
| Converts a string representation to a table. | |
Static Public Attributes | |
| static constexpr size_type | C0_LAYER_SSTABLE_MAX_ENTRIES {100'000} |
In-memory table for storing key-value pairs.
| TValue | The type of the value to be stored in the table. |
Definition at line 17 of file mem_table.h.
| using vkdb::MemTable< TValue >::key_type = TimeSeriesKey |
Definition at line 19 of file mem_table.h.
| using vkdb::MemTable< TValue >::mapped_type = std::optional<TValue> |
Definition at line 20 of file mem_table.h.
| using vkdb::MemTable< TValue >::size_type = uint64_t |
Definition at line 22 of file mem_table.h.
| using vkdb::MemTable< TValue >::table_type = std::map<const key_type, mapped_type> |
Definition at line 23 of file mem_table.h.
| using vkdb::MemTable< TValue >::value_type = std::pair<const key_type, mapped_type> |
Definition at line 21 of file mem_table.h.
|
inlinenoexcept |
Construct a new MemTable object from a map of entries.
| entries | The entries to initialise the table with. |
Definition at line 37 of file mem_table.h.
|
inlinenoexcept |
Clears the table.
Definition at line 142 of file mem_table.h.
|
inlinenodiscardnoexcept |
Checks if the table contains a key.
| key | The key to check. |
Definition at line 87 of file mem_table.h.
|
inlinenodiscardnoexcept |
Checks if the table is empty.
Definition at line 172 of file mem_table.h.
|
inlinestatic |
Converts a string representation to a table.
| str | The string representation of the table. |
| table | The table to populate. |
| std::exception | If converting any string to entry fails. |
Definition at line 198 of file mem_table.h.
|
inlinenodiscard |
Retrieves the value associated with a key.
| key | The key to retrieve the value for. |
| std::invalid_argument | If the key is not in the memtable. |
Definition at line 99 of file mem_table.h.
|
inlinenodiscard |
Retrieves a range of key-value pairs.
| start | The start key of the range. |
| end | The end key of the range. |
| std::exception | If getting the range fails. |
Definition at line 123 of file mem_table.h.
|
defaultnoexcept |
|
inline |
Inserts or updates a key-value pair in the table.
| key | The key to insert or update. |
| value | The value to associate with the key. |
| std::exception | If inserting or updating the key-value pair fails. |
Definition at line 75 of file mem_table.h.
|
inlinenodiscardnoexcept |
Returns the size of the table.
Definition at line 162 of file mem_table.h.
|
inlinenodiscardnoexcept |
Converts the table to a string representation.
Definition at line 181 of file mem_table.h.
|
inlinenodiscardnoexcept |
|
staticconstexpr |
Definition at line 25 of file mem_table.h.