diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-10-13 11:13:20 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-10-13 11:13:20 +1100 |
| commit | 20d1c280a77eadcea18438453dc37daaf1d85e2d (patch) | |
| tree | 9ec518001df706f9cfa7c46c01de622b900f47d5 /src/database/include | |
| parent | 53cf476876560723031128a0f1b47135de7167d1 (diff) | |
| download | tangara-fw-20d1c280a77eadcea18438453dc37daaf1d85e2d.tar.gz | |
Remove templating of Continuation
Diffstat (limited to 'src/database/include')
| -rw-r--r-- | src/database/include/database.hpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/database/include/database.hpp b/src/database/include/database.hpp index 6ad8d318..7cb1d09c 100644 --- a/src/database/include/database.hpp +++ b/src/database/include/database.hpp @@ -31,7 +31,6 @@ namespace database { -template <typename T> struct Continuation { std::pmr::string prefix; std::pmr::string start_key; @@ -52,12 +51,12 @@ class Result { return values_; } - auto next_page() -> std::optional<Continuation<T>>& { return next_page_; } - auto prev_page() -> std::optional<Continuation<T>>& { return prev_page_; } + auto next_page() -> std::optional<Continuation>& { return next_page_; } + auto prev_page() -> std::optional<Continuation>& { return prev_page_; } Result(const std::vector<std::shared_ptr<T>>&& values, - std::optional<Continuation<T>> next, - std::optional<Continuation<T>> prev) + std::optional<Continuation> next, + std::optional<Continuation> prev) : values_(values), next_page_(next), prev_page_(prev) {} Result(const Result&) = delete; @@ -65,8 +64,8 @@ class Result { private: std::vector<std::shared_ptr<T>> values_; - std::optional<Continuation<T>> next_page_; - std::optional<Continuation<T>> prev_page_; + std::optional<Continuation> next_page_; + std::optional<Continuation> prev_page_; }; class IndexRecord { @@ -78,7 +77,7 @@ class IndexRecord { auto text() const -> std::optional<std::pmr::string>; auto track() const -> std::optional<TrackId>; - auto Expand(std::size_t) const -> std::optional<Continuation<IndexRecord>>; + auto Expand(std::size_t) const -> std::optional<Continuation>; private: IndexKey key_; @@ -120,7 +119,7 @@ class Database { auto GetDump(std::size_t page_size) -> std::future<Result<std::pmr::string>*>; template <typename T> - auto GetPage(Continuation<T>* c) -> std::future<Result<T>*>; + auto GetPage(Continuation* c) -> std::future<Result<T>*>; Database(const Database&) = delete; Database& operator=(const Database&) = delete; @@ -153,7 +152,7 @@ class Database { auto dbCreateIndexesForTrack(const Track& track) -> void; template <typename T> - auto dbGetPage(const Continuation<T>& c) -> Result<T>*; + auto dbGetPage(const Continuation& c) -> Result<T>*; template <typename T> auto ParseRecord(const leveldb::Slice& key, const leveldb::Slice& val) |
