From 2086ab09b8d89c27f524d82a68b9a2035ea02436 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Tue, 24 Oct 2023 16:29:46 +1100 Subject: Implement incremental updates of database indexes This makes rescanning the library *so* much faster. Yay! --- src/database/include/track.hpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/database/include/track.hpp') diff --git a/src/database/include/track.hpp b/src/database/include/track.hpp index b07da9ba..72296e8d 100644 --- a/src/database/include/track.hpp +++ b/src/database/include/track.hpp @@ -83,6 +83,10 @@ class TrackTags { auto at(const Tag& key) const -> std::optional; auto operator[](const Tag& key) const -> std::optional; + auto tags() const -> const std::pmr::unordered_map& { + return tags_; + } + /* * Returns a hash of the 'identifying' tags of this track. That is, a hash * that can be used to determine if one track is likely the same as another, @@ -119,12 +123,14 @@ struct TrackData { : id(0), filepath(&memory::kSpiRamResource), tags_hash(0), + individual_tag_hashes(&memory::kSpiRamResource), is_tombstoned(false), modified_at() {} TrackId id; std::pmr::string filepath; uint64_t tags_hash; + std::pmr::unordered_map individual_tag_hashes; bool is_tombstoned; std::pair modified_at; -- cgit v1.2.3