diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-11-21 13:49:47 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-11-21 13:49:47 +1100 |
| commit | d70ec9bf447f7a46e347c3bc5ad58fd88aff46a2 (patch) | |
| tree | ab75c1663934d7408fad36d134a0cfd4f4cb089b /src/database/include | |
| parent | f34b6405884c4073158c3f36158c6351fa135a0f (diff) | |
| download | tangara-fw-d70ec9bf447f7a46e347c3bc5ad58fd88aff46a2.tar.gz | |
Add lua functions to get database content
Diffstat (limited to 'src/database/include')
| -rw-r--r-- | src/database/include/database.hpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/database/include/database.hpp b/src/database/include/database.hpp index 544e4a62..972871db 100644 --- a/src/database/include/database.hpp +++ b/src/database/include/database.hpp @@ -183,4 +183,21 @@ auto Database::ParseRecord<std::pmr::string>(const leveldb::Slice& key, const leveldb::Slice& val) -> std::shared_ptr<std::pmr::string>; +/* + * Utility for accessing a large set of database records, one record at a time. + */ +class Iterator { + public: + Iterator(std::weak_ptr<Database>, const IndexInfo&); + Iterator(std::weak_ptr<Database>, const Continuation&); + + auto Prev() -> std::optional<IndexRecord>; + auto Next() -> std::optional<IndexRecord>; + + private: + std::weak_ptr<Database> db_; + std::optional<Continuation> prev_pos_; + std::optional<Continuation> current_pos_; +}; + } // namespace database |
