IOThread: move EventThread instance into struct Instance
Eliminate global variables.
This commit is contained in:
@@ -117,7 +117,8 @@ handle_listfiles(Client &client, Request args, Response &r)
|
||||
case LocatedUri::Type::ABSOLUTE:
|
||||
#ifdef ENABLE_DATABASE
|
||||
/* use storage plugin to list remote directory */
|
||||
return handle_listfiles_storage(r, located_uri.canonical_uri);
|
||||
return handle_listfiles_storage(client, r,
|
||||
located_uri.canonical_uri);
|
||||
#else
|
||||
r.Error(ACK_ERROR_NO_EXIST, "No database");
|
||||
return CommandResult::ERROR;
|
||||
|
@@ -36,7 +36,6 @@
|
||||
#include "db/plugins/simple/SimpleDatabasePlugin.hxx"
|
||||
#include "db/update/Service.hxx"
|
||||
#include "TimePrint.hxx"
|
||||
#include "IOThread.hxx"
|
||||
#include "Idle.hxx"
|
||||
|
||||
#include <memory>
|
||||
@@ -107,9 +106,10 @@ handle_listfiles_storage(Response &r, Storage &storage, const char *uri)
|
||||
}
|
||||
|
||||
CommandResult
|
||||
handle_listfiles_storage(Response &r, const char *uri)
|
||||
handle_listfiles_storage(Client &client, Response &r, const char *uri)
|
||||
{
|
||||
std::unique_ptr<Storage> storage(CreateStorageURI(io_thread_get(), uri));
|
||||
auto &event_loop = client.partition.instance.io_thread.GetEventLoop();
|
||||
std::unique_ptr<Storage> storage(CreateStorageURI(event_loop, uri));
|
||||
if (storage == nullptr) {
|
||||
r.Error(ACK_ERROR_ARG, "Unrecognized storage URI");
|
||||
return CommandResult::ERROR;
|
||||
@@ -195,7 +195,8 @@ handle_mount(Client &client, Request args, Response &r)
|
||||
return CommandResult::ERROR;
|
||||
}
|
||||
|
||||
Storage *storage = CreateStorageURI(io_thread_get(), remote_uri);
|
||||
auto &event_loop = client.partition.instance.io_thread.GetEventLoop();
|
||||
Storage *storage = CreateStorageURI(event_loop, remote_uri);
|
||||
if (storage == nullptr) {
|
||||
r.Error(ACK_ERROR_ARG, "Unrecognized storage URI");
|
||||
return CommandResult::ERROR;
|
||||
|
@@ -31,7 +31,7 @@ CommandResult
|
||||
handle_listfiles_storage(Response &r, Storage &storage, const char *uri);
|
||||
|
||||
CommandResult
|
||||
handle_listfiles_storage(Response &r, const char *uri);
|
||||
handle_listfiles_storage(Client &client, Response &r, const char *uri);
|
||||
|
||||
CommandResult
|
||||
handle_listmounts(Client &client, Request request, Response &response);
|
||||
|
Reference in New Issue
Block a user