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/index.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/database/include/index.hpp') 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 track; }; -auto Index(const IndexInfo&, const Track&, leveldb::WriteBatch*) -> bool; +auto Index(const IndexInfo&, const Track&) + -> std::vector>; + auto ExpandHeader(const IndexKey::Header&, const std::optional&) -> IndexKey::Header; -- cgit v1.2.3