From 009f69c929eb1d1b65d75b0937fbf3b8de5d9148 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Tue, 5 Dec 2023 17:00:28 +1100 Subject: Add basic track queue save/load support Not wired up yet; I need to do a bunch of cleanup before i wire it in --- src/database/include/database.hpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/database/include') diff --git a/src/database/include/database.hpp b/src/database/include/database.hpp index 263153fb..327db3cb 100644 --- a/src/database/include/database.hpp +++ b/src/database/include/database.hpp @@ -18,6 +18,7 @@ #include #include "collation.hpp" +#include "cppbor.h" #include "file_gatherer.hpp" #include "index.hpp" #include "leveldb/cache.h" @@ -105,6 +106,9 @@ class Database { ~Database(); + auto Put(const std::string& key, const std::string& val) -> void; + auto Get(const std::string& key) -> std::optional; + auto Update() -> std::future; auto GetTrackPath(TrackId id) -> std::future>; @@ -194,6 +198,9 @@ auto Database::ParseRecord(const leveldb::Slice& key, */ class Iterator { public: + static auto Parse(std::weak_ptr, const cppbor::Array&) + -> std::optional; + Iterator(std::weak_ptr, const IndexInfo&); Iterator(std::weak_ptr, const Continuation&); Iterator(const Iterator&); @@ -213,7 +220,13 @@ class Iterator { auto Size() const -> size_t; + auto cbor() const -> cppbor::Array&&; + private: + Iterator(std::weak_ptr, + std::optional&&, + std::optional&&); + friend class TrackIterator; auto InvokeNull(Callback) -> void; @@ -227,6 +240,9 @@ class Iterator { class TrackIterator { public: + static auto Parse(std::weak_ptr, const cppbor::Array&) + -> std::optional; + TrackIterator(const Iterator&); TrackIterator(const TrackIterator&); @@ -235,7 +251,11 @@ class TrackIterator { auto Next() -> std::optional; auto Size() const -> size_t; + auto cbor() const -> cppbor::Array&&; + private: + TrackIterator(std::weak_ptr); + auto NextLeaf() -> void; std::weak_ptr db_; -- cgit v1.2.3