summaryrefslogtreecommitdiff
path: root/src/database/include
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-01-30 11:03:31 +1100
committerjacqueline <me@jacqueline.id.au>2024-01-30 11:03:31 +1100
commiteacea59e8a3f9602ed06834a8edc4e6ab18a4bb9 (patch)
treecfafc753e2f9280dd81d2cb48520a427da54e141 /src/database/include
parentc399199bfccb5298fe4b0cf566d8e69729596ba4 (diff)
downloadtangara-fw-eacea59e8a3f9602ed06834a8edc4e6ab18a4bb9.tar.gz
Do more to avoid and recover from partial db updates
- do not power off in an update is in progress - explicitly store last update time, rather than deriving it from unchanged tracks.
Diffstat (limited to 'src/database/include')
-rw-r--r--src/database/include/database.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/database/include/database.hpp b/src/database/include/database.hpp
index cb4064fb..c4da3dc1 100644
--- a/src/database/include/database.hpp
+++ b/src/database/include/database.hpp
@@ -78,6 +78,7 @@ class Database {
auto getIndexes() -> std::vector<IndexInfo>;
auto updateIndexes() -> void;
+ auto isUpdating() -> bool;
// Cannot be copied or moved.
Database(const Database&) = delete;
@@ -96,12 +97,17 @@ class Database {
ITagParser& tag_parser_;
locale::ICollator& collator_;
+ std::atomic<bool> is_updating_;
+
Database(leveldb::DB* db,
leveldb::Cache* cache,
IFileGatherer& file_gatherer,
ITagParser& tag_parser,
locale::ICollator& collator);
+ auto dbGetLastUpdate() -> std::pair<uint16_t, uint16_t>;
+ auto dbSetLastUpdate(std::pair<uint16_t, uint16_t>) -> void;
+
auto dbMintNewTrackId() -> TrackId;
auto dbEntomb(TrackId track, uint64_t hash) -> void;