summaryrefslogtreecommitdiff
path: root/src/database/include/index.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/index.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/index.hpp')
-rw-r--r--src/database/include/index.hpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/database/include/index.hpp b/src/database/include/index.hpp
index 838eff31..13de952d 100644
--- a/src/database/include/index.hpp
+++ b/src/database/include/index.hpp
@@ -46,6 +46,8 @@ struct IndexKey {
// an index consists of { kArtist, kAlbum, kTitle }, and we are at depth = 2
// then this may contain hash(hash("Jacqueline"), "My Cool Album").
std::uint64_t components_hash;
+
+ bool operator==(const Header&) const = default;
};
Header header;
@@ -58,7 +60,9 @@ struct IndexKey {
std::optional<TrackId> track;
};
-auto Index(const IndexInfo&, const Track&, leveldb::WriteBatch*) -> bool;
+auto Index(const IndexInfo&, const Track&)
+ -> std::vector<std::pair<IndexKey, std::pmr::string>>;
+
auto ExpandHeader(const IndexKey::Header&,
const std::optional<std::pmr::string>&) -> IndexKey::Header;