summaryrefslogtreecommitdiff
path: root/src/command/StorageCommands.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-02-25 10:00:05 +0100
committerMax Kellermann <max@musicpd.org>2017-02-25 10:20:05 +0100
commit05b8ddac4c9318bd8f9851d0e5a58edd7eb9f340 (patch)
treeaa7c6e232e26117c3b218b7ae2eff8b447cbc206 /src/command/StorageCommands.cxx
parent668724de4e94c3191f0f593ba261c91d076728fc (diff)
Client: add method GetInstance()
Diffstat (limited to 'src/command/StorageCommands.cxx')
-rw-r--r--src/command/StorageCommands.cxx22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/command/StorageCommands.cxx b/src/command/StorageCommands.cxx
index 87bb44199..2eaba21b3 100644
--- a/src/command/StorageCommands.cxx
+++ b/src/command/StorageCommands.cxx
@@ -109,7 +109,7 @@ handle_listfiles_storage(Response &r, Storage &storage, const char *uri)
CommandResult
handle_listfiles_storage(Client &client, Response &r, const char *uri)
{
- auto &event_loop = client.partition.instance.io_thread.GetEventLoop();
+ auto &event_loop = client.GetInstance().io_thread.GetEventLoop();
std::unique_ptr<Storage> storage(CreateStorageURI(event_loop, uri));
if (storage == nullptr) {
r.Error(ACK_ERROR_ARG, "Unrecognized storage URI");
@@ -148,7 +148,7 @@ print_storage_uri(Client &client, Response &r, const Storage &storage)
CommandResult
handle_listmounts(Client &client, gcc_unused Request args, Response &r)
{
- Storage *_composite = client.partition.instance.storage;
+ Storage *_composite = client.GetInstance().storage;
if (_composite == nullptr) {
r.Error(ACK_ERROR_NO_EXIST, "No database");
return CommandResult::ERROR;
@@ -170,7 +170,9 @@ handle_listmounts(Client &client, gcc_unused Request args, Response &r)
CommandResult
handle_mount(Client &client, Request args, Response &r)
{
- Storage *_composite = client.partition.instance.storage;
+ auto &instance = client.GetInstance();
+
+ Storage *_composite = instance.storage;
if (_composite == nullptr) {
r.Error(ACK_ERROR_NO_EXIST, "No database");
return CommandResult::ERROR;
@@ -196,7 +198,7 @@ handle_mount(Client &client, Request args, Response &r)
return CommandResult::ERROR;
}
- auto &event_loop = client.partition.instance.io_thread.GetEventLoop();
+ auto &event_loop = instance.io_thread.GetEventLoop();
Storage *storage = CreateStorageURI(event_loop, remote_uri);
if (storage == nullptr) {
r.Error(ACK_ERROR_ARG, "Unrecognized storage URI");
@@ -207,7 +209,7 @@ handle_mount(Client &client, Request args, Response &r)
client.partition.EmitIdle(IDLE_MOUNT);
#ifdef ENABLE_DATABASE
- Database *_db = client.partition.instance.database;
+ Database *_db = instance.database;
if (_db != nullptr && _db->IsPlugin(simple_db_plugin)) {
SimpleDatabase &db = *(SimpleDatabase *)_db;
@@ -230,7 +232,9 @@ handle_mount(Client &client, Request args, Response &r)
CommandResult
handle_unmount(Client &client, Request args, Response &r)
{
- Storage *_composite = client.partition.instance.storage;
+ auto &instance = client.GetInstance();
+
+ Storage *_composite = instance.storage;
if (_composite == nullptr) {
r.Error(ACK_ERROR_NO_EXIST, "No database");
return CommandResult::ERROR;
@@ -246,13 +250,13 @@ handle_unmount(Client &client, Request args, Response &r)
}
#ifdef ENABLE_DATABASE
- if (client.partition.instance.update != nullptr)
+ if (instance.update != nullptr)
/* ensure that no database update will attempt to work
with the database/storage instances we're about to
destroy here */
- client.partition.instance.update->CancelMount(local_uri);
+ instance.update->CancelMount(local_uri);
- Database *_db = client.partition.instance.database;
+ Database *_db = instance.database;
if (_db != nullptr && _db->IsPlugin(simple_db_plugin)) {
SimpleDatabase &db = *(SimpleDatabase *)_db;