|
vkdb
A time series database engine in C++.
|
LSM tree on TimeSeriesKey. More...
#include <lsm_tree.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 = typename MemTable<TValue>::table_type |
Public Member Functions | |
| LSMTree (FilePath path) noexcept | |
| Construct a new LSMTree object. | |
| LSMTree (LSMTree &&) noexcept=default | |
| Move-construct a LSMTree object. | |
| LSMTree & | operator= (LSMTree &&) noexcept=default |
| Move-assign a LSMTree object. | |
| LSMTree (const LSMTree &)=delete | |
| Deleted copy constructor. | |
| LSMTree & | operator= (const LSMTree &)=delete |
| Deleted copy assignment operator. | |
| ~LSMTree () noexcept=default | |
| Destroy the LSMTree object. | |
| void | put (const key_type &key, const TValue &value, bool log=true) |
| Put a key-value pair into the LSM tree. | |
| void | remove (const key_type &key, bool log=true) |
| Remove a key pair from the LSM tree. | |
| mapped_type | get (const key_type &key) const noexcept |
| Get a value from the LSM tree. | |
| std::vector< value_type > | getRange (const key_type &start, const key_type &end, TimeSeriesKeyFilter &&filter) const |
| Get a filtered set of entries in a timestamp range. | |
| void | replayWAL () |
| Replay the write-ahead log. | |
| void | clear () noexcept |
| Clear the LSM tree. | |
| std::string | str () const noexcept |
| Convert the LSM tree to a string. | |
| size_type | sstableCount () const noexcept |
| Get the number of SSTables in the LSM tree. | |
| size_type | sstableCount (size_type k) const |
| Get the number of SSTables in a Ck layer. | |
| bool | empty () const noexcept |
| Check if the LSM tree is empty. | |
Static Public Attributes | |
| static constexpr size_type | LAYER_COUNT {8} |
| static constexpr size_type | CACHE_CAPACITY {10'000} |
| Max number of entries in the cache. | |
LSM tree on TimeSeriesKey.
| TValue | Value type. |
| using vkdb::LSMTree< TValue >::key_type = TimeSeriesKey |
Definition at line 39 of file lsm_tree.h.
| using vkdb::LSMTree< TValue >::mapped_type = std::optional<TValue> |
Definition at line 40 of file lsm_tree.h.
| using vkdb::LSMTree< TValue >::size_type = uint64_t |
Definition at line 42 of file lsm_tree.h.
| using vkdb::LSMTree< TValue >::table_type = typename MemTable<TValue>::table_type |
Definition at line 43 of file lsm_tree.h.
| using vkdb::LSMTree< TValue >::value_type = std::pair<const key_type, mapped_type> |
Definition at line 41 of file lsm_tree.h.
|
inlineexplicitnoexcept |
Construct a new LSMTree object.
Loads SSTables from disk.
| path | Path of the LSM tree. |
Definition at line 59 of file lsm_tree.h.
|
inlinenoexcept |
Clear the LSM tree.
Remove all SSTable files and the WAL file.
Definition at line 212 of file lsm_tree.h.
|
inlinenodiscardnoexcept |
Check if the LSM tree is empty.
Definition at line 280 of file lsm_tree.h.
|
inlinenodiscardnoexcept |
Get a value from the LSM tree.
| key | Key. |
Definition at line 145 of file lsm_tree.h.
|
inlinenodiscard |
Get a filtered set of entries in a timestamp range.
| start | Start timestamp. |
| end | End timestamp. |
| filter | Filter. |
| std::exception | If getting the entries fails. |
Definition at line 179 of file lsm_tree.h.
|
inline |
Put a key-value pair into the LSM tree.
| key | Key. |
| value | Value. |
| log | Whether to log the operation in the WAL. |
| std::runtime_error | If compaction fails in flushing. |
Definition at line 108 of file lsm_tree.h.
|
inline |
Remove a key pair from the LSM tree.
| key | Key. |
| log | Whether to log the operation in the WAL. |
| std::runtime_error | If the memtable is flushed when the C1 layer is full. |
Definition at line 128 of file lsm_tree.h.
|
inline |
Replay the write-ahead log.
Definition at line 203 of file lsm_tree.h.
|
inlinenodiscardnoexcept |
Get the number of SSTables in the LSM tree.
Definition at line 249 of file lsm_tree.h.
|
inlinenodiscard |
Get the number of SSTables in a Ck layer.
| k | Ck layer index. |
| std::out_of_range | If the layer index is out of range. |
Definition at line 265 of file lsm_tree.h.
|
inlinenodiscardnoexcept |
Convert the LSM tree to a string.
Definition at line 233 of file lsm_tree.h.
|
staticconstexpr |
Max number of entries in the cache.
Definition at line 51 of file lsm_tree.h.
|
staticconstexpr |
Definition at line 45 of file lsm_tree.h.