diff options
author | Max Kellermann <max@duempel.org> | 2014-02-26 08:39:44 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-02-27 20:49:13 +0100 |
commit | e9a85aa4e4d0634548b5c97461beb27ae5559338 (patch) | |
tree | 7cdfdd0ae0d990a8adbecc34f32d073627483205 /src/db/update/Queue.hxx | |
parent | 2a16fc74fd354484a70efcc5b6dbfcdd73ee5f5a (diff) | |
download | mpd-e9a85aa4e4d0634548b5c97461beb27ae5559338.tar.gz mpd-e9a85aa4e4d0634548b5c97461beb27ae5559338.tar.xz mpd-e9a85aa4e4d0634548b5c97461beb27ae5559338.zip |
db/simple: mount points
A SimpleDatabase instance can now "mount" other Database instances at
certain locations. This is used to use a new SimpleDatabase instance
for each storage mount (issued with the "mount" protocol command).
Each such instance has its own database file, stored in the directory
that is specified with the "cache_directory" option.
Diffstat (limited to 'src/db/update/Queue.hxx')
-rw-r--r-- | src/db/update/Queue.hxx | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/db/update/Queue.hxx b/src/db/update/Queue.hxx index 039c62fe3..9064ea481 100644 --- a/src/db/update/Queue.hxx +++ b/src/db/update/Queue.hxx @@ -21,19 +21,30 @@ #define MPD_UPDATE_QUEUE_HXX #include "check.h" +#include "Compiler.h" #include <string> #include <list> +class SimpleDatabase; +class Storage; + struct UpdateQueueItem { + SimpleDatabase *db; + Storage *storage; + std::string path_utf8; unsigned id; bool discard; UpdateQueueItem():id(0) {} - UpdateQueueItem(const char *_path, bool _discard, + + UpdateQueueItem(SimpleDatabase &_db, + Storage &_storage, + const char *_path, bool _discard, unsigned _id) - :path_utf8(_path), id(_id), discard(_discard) {} + :db(&_db), storage(&_storage), path_utf8(_path), + id(_id), discard(_discard) {} bool IsDefined() const { return id != 0; @@ -46,13 +57,21 @@ class UpdateQueue { std::list<UpdateQueueItem> update_queue; public: - bool Push(const char *path, bool discard, unsigned id); + gcc_nonnull_all + bool Push(SimpleDatabase &db, Storage &storage, + const char *path, bool discard, unsigned id); UpdateQueueItem Pop(); void Clear() { update_queue.clear(); } + + gcc_nonnull_all + void Erase(SimpleDatabase &db); + + gcc_nonnull_all + void Erase(Storage &storage); }; #endif |