diff options
author | Max Kellermann <max@duempel.org> | 2014-02-01 00:26:34 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-02-04 11:22:33 +0100 |
commit | cf6281a5a758e4b93d67f7fd5804a8cff60ddbf9 (patch) | |
tree | 7368011b1ecf5ae6db6dcafb676fddf03ff9d823 /src/client | |
parent | f00710a57e80738c33255eaa1347ab776fbce869 (diff) | |
download | mpd-cf6281a5a758e4b93d67f7fd5804a8cff60ddbf9.tar.gz mpd-cf6281a5a758e4b93d67f7fd5804a8cff60ddbf9.tar.xz mpd-cf6281a5a758e4b93d67f7fd5804a8cff60ddbf9.zip |
Instance: add Database attribute
Move from db/DatabaseGlue.cxx, eliminating global variable.
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/Client.cxx | 12 | ||||
-rw-r--r-- | src/client/Client.hxx | 6 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/client/Client.cxx b/src/client/Client.cxx index ce99faa89..c62c759e9 100644 --- a/src/client/Client.cxx +++ b/src/client/Client.cxx @@ -20,5 +20,17 @@ #include "config.h" #include "ClientInternal.hxx" #include "util/Domain.hxx" +#include "Partition.hxx" +#include "Instance.hxx" const Domain client_domain("client"); + +#ifdef ENABLE_DATABASE + +const Database * +Client::GetDatabase(Error &error) const +{ + return partition.instance.GetDatabase(error); +} + +#endif diff --git a/src/client/Client.hxx b/src/client/Client.hxx index 708b0d03d..006ffc98c 100644 --- a/src/client/Client.hxx +++ b/src/client/Client.hxx @@ -38,6 +38,7 @@ struct sockaddr; class EventLoop; class Path; struct Partition; +class Database; class Client final : private FullyBufferedSocket, TimeoutMonitor { public: @@ -169,6 +170,11 @@ public: */ bool AllowFile(Path path_fs, Error &error) const; + /** + * Wrapper for Instance::GetDatabase(). + */ + const Database *GetDatabase(Error &error) const; + private: /* virtual methods from class BufferedSocket */ virtual InputResult OnSocketInput(void *data, size_t length) override; |