diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-10-30 15:47:38 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-10-30 15:52:26 +1100 |
| commit | b58c08150853b8055093dc116d407ffd543f8ec8 (patch) | |
| tree | 9b82d130d2c833fc234bca0f12f0fba1b7202c4d /src/database/include | |
| parent | 18d90051c9145ead86d4da701a2bc54f45e4fb66 (diff) | |
| download | tangara-fw-b58c08150853b8055093dc116d407ffd543f8ec8.tar.gz | |
add locale-aware colation to db indexes
Diffstat (limited to 'src/database/include')
| -rw-r--r-- | src/database/include/database.hpp | 8 | ||||
| -rw-r--r-- | src/database/include/index.hpp | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/database/include/database.hpp b/src/database/include/database.hpp index cdf69db0..5eb3a8e9 100644 --- a/src/database/include/database.hpp +++ b/src/database/include/database.hpp @@ -16,6 +16,7 @@ #include <utility> #include <vector> +#include "collation.hpp" #include "file_gatherer.hpp" #include "index.hpp" #include "leveldb/cache.h" @@ -92,9 +93,10 @@ class Database { ALREADY_OPEN, FAILED_TO_OPEN, }; - static auto Open(IFileGatherer& file_gatherer, ITagParser& tag_parser) + static auto Open(IFileGatherer& file_gatherer, + ITagParser& tag_parser, + locale::ICollator& collator) -> cpp::result<Database*, DatabaseError>; - static auto Open() -> cpp::result<Database*, DatabaseError>; static auto Destroy() -> void; @@ -136,11 +138,13 @@ class Database { // Not owned. IFileGatherer& file_gatherer_; ITagParser& tag_parser_; + locale::ICollator& collator_; Database(leveldb::DB* db, leveldb::Cache* cache, IFileGatherer& file_gatherer, ITagParser& tag_parser, + locale::ICollator& collator, std::shared_ptr<tasks::Worker> worker); auto dbMintNewTrackId() -> TrackId; diff --git a/src/database/include/index.hpp b/src/database/include/index.hpp index 13de952d..15b21ee8 100644 --- a/src/database/include/index.hpp +++ b/src/database/include/index.hpp @@ -13,6 +13,7 @@ #include <variant> #include <vector> +#include "collation.hpp" #include "leveldb/db.h" #include "leveldb/slice.h" @@ -60,7 +61,7 @@ struct IndexKey { std::optional<TrackId> track; }; -auto Index(const IndexInfo&, const Track&) +auto Index(locale::ICollator&, const IndexInfo&, const Track&) -> std::vector<std::pair<IndexKey, std::pmr::string>>; auto ExpandHeader(const IndexKey::Header&, |
