summaryrefslogtreecommitdiff
path: root/src/tangara/database
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-05-02 21:41:56 +1000
committerjacqueline <me@jacqueline.id.au>2024-05-02 21:41:56 +1000
commit7d7f7755d17e1e0a2348d75d797097f166b70471 (patch)
tree1129eef470a90fc954a0c6f281e8d94fe0339101 /src/tangara/database
parent1573a8c4cde1cd9528b422b2dcc598e37ffe94a7 (diff)
downloadtangara-fw-7d7f7755d17e1e0a2348d75d797097f166b70471.tar.gz
start moving include files into subdirs
Diffstat (limited to 'src/tangara/database')
-rw-r--r--src/tangara/database/database.cpp22
-rw-r--r--src/tangara/database/database.hpp10
-rw-r--r--src/tangara/database/env_esp.cpp4
-rw-r--r--src/tangara/database/file_gatherer.cpp2
-rw-r--r--src/tangara/database/file_gatherer.hpp12
-rw-r--r--src/tangara/database/future_fetcher.hpp2
-rw-r--r--src/tangara/database/index.cpp11
-rw-r--r--src/tangara/database/index.hpp7
-rw-r--r--src/tangara/database/records.cpp6
-rw-r--r--src/tangara/database/records.hpp4
-rw-r--r--src/tangara/database/tag_parser.cpp2
-rw-r--r--src/tangara/database/tag_parser.hpp2
-rw-r--r--src/tangara/database/test/test_database.cpp16
-rw-r--r--src/tangara/database/test/test_records.cpp2
-rw-r--r--src/tangara/database/track.cpp2
15 files changed, 52 insertions, 52 deletions
diff --git a/src/tangara/database/database.cpp b/src/tangara/database/database.cpp
index 48fb0c63..ddb63907 100644
--- a/src/tangara/database/database.cpp
+++ b/src/tangara/database/database.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "database.hpp"
+#include "database/database.hpp"
#include <stdint.h>
#include <sys/_stdint.h>
@@ -23,10 +23,10 @@
#include "collation.hpp"
#include "cppbor.h"
#include "cppbor_parse.h"
+#include "database/index.hpp"
#include "esp_log.h"
#include "ff.h"
#include "freertos/projdefs.h"
-#include "index.hpp"
#include "komihash.h"
#include "leveldb/cache.h"
#include "leveldb/db.h"
@@ -36,17 +36,17 @@
#include "leveldb/status.h"
#include "leveldb/write_batch.h"
-#include "db_events.hpp"
-#include "env_esp.hpp"
-#include "event_queue.hpp"
-#include "file_gatherer.hpp"
+#include "database/db_events.hpp"
+#include "database/env_esp.hpp"
+#include "database/file_gatherer.hpp"
+#include "database/records.hpp"
+#include "database/tag_parser.hpp"
+#include "database/track.hpp"
+#include "events/event_queue.hpp"
#include "memory_resource.hpp"
-#include "records.hpp"
#include "result.hpp"
#include "spi.hpp"
-#include "tag_parser.hpp"
#include "tasks.hpp"
-#include "track.hpp"
namespace database {
@@ -63,8 +63,8 @@ static const char kKeyTrackId[] = "next_track_id";
static std::atomic<bool> sIsDbOpen(false);
-static auto CreateNewDatabase(leveldb::Options& options, locale::ICollator& col)
- -> leveldb::DB* {
+static auto CreateNewDatabase(leveldb::Options& options,
+ locale::ICollator& col) -> leveldb::DB* {
Database::Destroy();
leveldb::DB* db;
options.create_if_missing = true;
diff --git a/src/tangara/database/database.hpp b/src/tangara/database/database.hpp
index 35b76a13..d2de7c72 100644
--- a/src/tangara/database/database.hpp
+++ b/src/tangara/database/database.hpp
@@ -19,19 +19,19 @@
#include "collation.hpp"
#include "cppbor.h"
-#include "file_gatherer.hpp"
-#include "index.hpp"
+#include "database/file_gatherer.hpp"
+#include "database/index.hpp"
+#include "database/records.hpp"
+#include "database/tag_parser.hpp"
+#include "database/track.hpp"
#include "leveldb/cache.h"
#include "leveldb/db.h"
#include "leveldb/iterator.h"
#include "leveldb/options.h"
#include "leveldb/slice.h"
#include "memory_resource.hpp"
-#include "records.hpp"
#include "result.hpp"
-#include "tag_parser.hpp"
#include "tasks.hpp"
-#include "track.hpp"
namespace database {
diff --git a/src/tangara/database/env_esp.cpp b/src/tangara/database/env_esp.cpp
index f7a5637a..2cf74c3e 100644
--- a/src/tangara/database/env_esp.cpp
+++ b/src/tangara/database/env_esp.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "env_esp.hpp"
+#include "database/env_esp.hpp"
#include <atomic>
#include <cerrno>
@@ -41,7 +41,7 @@
namespace leveldb {
-tasks::WorkerPool *sBackgroundThread = nullptr;
+tasks::WorkerPool* sBackgroundThread = nullptr;
std::string ErrToStr(FRESULT err) {
switch (err) {
diff --git a/src/tangara/database/file_gatherer.cpp b/src/tangara/database/file_gatherer.cpp
index b7b7271e..141259c2 100644
--- a/src/tangara/database/file_gatherer.cpp
+++ b/src/tangara/database/file_gatherer.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "file_gatherer.hpp"
+#include "database/file_gatherer.hpp"
#include <deque>
#include <functional>
diff --git a/src/tangara/database/file_gatherer.hpp b/src/tangara/database/file_gatherer.hpp
index 685bdb2c..38558b9e 100644
--- a/src/tangara/database/file_gatherer.hpp
+++ b/src/tangara/database/file_gatherer.hpp
@@ -17,20 +17,18 @@ namespace database {
class IFileGatherer {
public:
- virtual ~IFileGatherer(){};
+ virtual ~IFileGatherer() {};
virtual auto FindFiles(
const std::string& root,
- std::function<void(std::string_view, const FILINFO&)> cb)
- -> void = 0;
+ std::function<void(std::string_view, const FILINFO&)> cb) -> void = 0;
};
class FileGathererImpl : public IFileGatherer {
public:
- virtual auto FindFiles(
- const std::string& root,
- std::function<void(std::string_view, const FILINFO&)> cb)
- -> void override;
+ virtual auto FindFiles(const std::string& root,
+ std::function<void(std::string_view, const FILINFO&)>
+ cb) -> void override;
};
} // namespace database
diff --git a/src/tangara/database/future_fetcher.hpp b/src/tangara/database/future_fetcher.hpp
index e8ce9729..a27101f1 100644
--- a/src/tangara/database/future_fetcher.hpp
+++ b/src/tangara/database/future_fetcher.hpp
@@ -9,7 +9,7 @@
#include <memory>
#include <utility>
-#include "database.hpp"
+#include "database/database.hpp"
namespace database {
diff --git a/src/tangara/database/index.cpp b/src/tangara/database/index.cpp
index 328c3b43..93a2b1c2 100644
--- a/src/tangara/database/index.cpp
+++ b/src/tangara/database/index.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "index.hpp"
+#include "database/index.hpp"
#include <sys/_stdint.h>
#include <cstdint>
@@ -21,8 +21,8 @@
#include "komihash.h"
#include "leveldb/write_batch.h"
-#include "records.hpp"
-#include "track.hpp"
+#include "database/records.hpp"
+#include "database/track.hpp"
namespace database {
@@ -183,8 +183,9 @@ auto Indexer::handleItem(const IndexKey::Header& header,
}
}
-auto Index(locale::ICollator& c, const IndexInfo& i, const Track& t)
- -> std::vector<std::pair<IndexKey, std::string>> {
+auto Index(locale::ICollator& c,
+ const IndexInfo& i,
+ const Track& t) -> std::vector<std::pair<IndexKey, std::string>> {
Indexer indexer{c, t, i};
return indexer.index();
}
diff --git a/src/tangara/database/index.hpp b/src/tangara/database/index.hpp
index 45dae464..8f78439b 100644
--- a/src/tangara/database/index.hpp
+++ b/src/tangara/database/index.hpp
@@ -17,9 +17,9 @@
#include "leveldb/db.h"
#include "leveldb/slice.h"
+#include "database/track.hpp"
#include "leveldb/write_batch.h"
#include "memory_resource.hpp"
-#include "track.hpp"
namespace database {
@@ -61,8 +61,9 @@ struct IndexKey {
std::optional<TrackId> track;
};
-auto Index(locale::ICollator&, const IndexInfo&, const Track&)
- -> std::vector<std::pair<IndexKey, std::string>>;
+auto Index(locale::ICollator&,
+ const IndexInfo&,
+ const Track&) -> std::vector<std::pair<IndexKey, std::string>>;
auto ExpandHeader(const IndexKey::Header&,
const std::optional<std::pmr::string>&) -> IndexKey::Header;
diff --git a/src/tangara/database/records.cpp b/src/tangara/database/records.cpp
index b086be3b..88ddbd91 100644
--- a/src/tangara/database/records.cpp
+++ b/src/tangara/database/records.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "records.hpp"
+#include "database/records.hpp"
#include <stdint.h>
#include <sys/_stdint.h>
@@ -21,10 +21,10 @@
#include "cppbor_parse.h"
#include "esp_log.h"
-#include "index.hpp"
+#include "database/index.hpp"
+#include "database/track.hpp"
#include "komihash.h"
#include "memory_resource.hpp"
-#include "track.hpp"
// As LevelDB is a key-value store, each record in the database consists of a
// key and an optional value.
diff --git a/src/tangara/database/records.hpp b/src/tangara/database/records.hpp
index 3ca68fea..db18fe2f 100644
--- a/src/tangara/database/records.hpp
+++ b/src/tangara/database/records.hpp
@@ -15,9 +15,9 @@
#include "leveldb/db.h"
#include "leveldb/slice.h"
-#include "index.hpp"
+#include "database/index.hpp"
+#include "database/track.hpp"
#include "memory_resource.hpp"
-#include "track.hpp"
namespace database {
diff --git a/src/tangara/database/tag_parser.cpp b/src/tangara/database/tag_parser.cpp
index cbcbdcb5..86bd6443 100644
--- a/src/tangara/database/tag_parser.cpp
+++ b/src/tangara/database/tag_parser.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "tag_parser.hpp"
+#include "database/tag_parser.hpp"
#include <cstdint>
#include <cstdlib>
diff --git a/src/tangara/database/tag_parser.hpp b/src/tangara/database/tag_parser.hpp
index 966258b5..ccbc0ea9 100644
--- a/src/tangara/database/tag_parser.hpp
+++ b/src/tangara/database/tag_parser.hpp
@@ -8,8 +8,8 @@
#include <string>
+#include "database/track.hpp"
#include "lru_cache.hpp"
-#include "track.hpp"
namespace database {
diff --git a/src/tangara/database/test/test_database.cpp b/src/tangara/database/test/test_database.cpp
index 6aec9bfb..09e19a43 100644
--- a/src/tangara/database/test/test_database.cpp
+++ b/src/tangara/database/test/test_database.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "database.hpp"
+#include "database/database.hpp"
#include <stdint.h>
#include <iomanip>
@@ -13,14 +13,14 @@
#include <string>
#include "catch2/catch.hpp"
+#include "database/file_gatherer.hpp"
+#include "database/tag_parser.hpp"
+#include "database/track.hpp"
#include "driver_cache.hpp"
#include "esp_log.h"
-#include "file_gatherer.hpp"
#include "i2c_fixture.hpp"
#include "leveldb/db.h"
#include "spi_fixture.hpp"
-#include "tag_parser.hpp"
-#include "track.hpp"
namespace database {
@@ -28,8 +28,8 @@ class TestBackends : public IFileGatherer, public ITagParser {
public:
std::map<std::pmr::string, TrackTags> tracks;
- auto MakeTrack(const std::pmr::string& path, const std::pmr::string& title)
- -> void {
+ auto MakeTrack(const std::pmr::string& path,
+ const std::pmr::string& title) -> void {
TrackTags tags;
tags.encoding = Encoding::kMp3;
tags.title = title;
@@ -44,8 +44,8 @@ class TestBackends : public IFileGatherer, public ITagParser {
}
}
- auto ReadAndParseTags(const std::pmr::string& path, TrackTags* out)
- -> bool override {
+ auto ReadAndParseTags(const std::pmr::string& path,
+ TrackTags* out) -> bool override {
if (tracks.contains(path)) {
*out = tracks.at(path);
return true;
diff --git a/src/tangara/database/test/test_records.cpp b/src/tangara/database/test/test_records.cpp
index 2f59489c..f8eb980f 100644
--- a/src/tangara/database/test/test_records.cpp
+++ b/src/tangara/database/test/test_records.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "records.hpp"
+#include "database/records.hpp"
#include <stdint.h>
#include <iomanip>
diff --git a/src/tangara/database/track.cpp b/src/tangara/database/track.cpp
index 1b1442a1..5bf8c3e2 100644
--- a/src/tangara/database/track.cpp
+++ b/src/tangara/database/track.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-only
*/
-#include "track.hpp"
+#include "database/track.hpp"
#include <iomanip>
#include <iostream>