summaryrefslogtreecommitdiff
path: root/src/database/include/track.hpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-10-24 16:29:46 +1100
committerjacqueline <me@jacqueline.id.au>2023-10-24 16:29:46 +1100
commit2086ab09b8d89c27f524d82a68b9a2035ea02436 (patch)
treee84765353237e23487b9fe6ceae8faeb13b2a94d /src/database/include/track.hpp
parent4f8c127da926bc1e1724e7686a42d37c1da0f563 (diff)
downloadtangara-fw-2086ab09b8d89c27f524d82a68b9a2035ea02436.tar.gz
Implement incremental updates of database indexes
This makes rescanning the library *so* much faster. Yay!
Diffstat (limited to 'src/database/include/track.hpp')
-rw-r--r--src/database/include/track.hpp6
1 files changed, 6 insertions, 0 deletions
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<std::pmr::string>;
auto operator[](const Tag& key) const -> std::optional<std::pmr::string>;
+ auto tags() const -> const std::pmr::unordered_map<Tag, std::pmr::string>& {
+ 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<Tag, uint64_t> individual_tag_hashes;
bool is_tombstoned;
std::pair<uint16_t, uint16_t> modified_at;