You need to sign in or sign up before continuing.
Commit 293ed924 authored by Max Kellermann's avatar Max Kellermann

command/queue: pass Partition to AddDatabaseSelection()

parent c8121176
...@@ -53,18 +53,17 @@ AddUri(Client &client, const LocatedUri &uri) ...@@ -53,18 +53,17 @@ AddUri(Client &client, const LocatedUri &uri)
} }
static CommandResult static CommandResult
AddDatabaseSelection(Client &client, const char *uri, AddDatabaseSelection(Partition &partition, const char *uri,
[[maybe_unused]] Response &r) [[maybe_unused]] Response &r)
{ {
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
auto &partition = client.GetPartition();
const ScopeBulkEdit bulk_edit(partition); const ScopeBulkEdit bulk_edit(partition);
const DatabaseSelection selection(uri, true); const DatabaseSelection selection(uri, true);
AddFromDatabase(partition, selection); AddFromDatabase(partition, selection);
return CommandResult::OK; return CommandResult::OK;
#else #else
(void)client; (void)partition;
(void)uri; (void)uri;
r.Error(ACK_ERROR_NO_EXIST, "No database"); r.Error(ACK_ERROR_NO_EXIST, "No database");
...@@ -75,6 +74,8 @@ AddDatabaseSelection(Client &client, const char *uri, ...@@ -75,6 +74,8 @@ AddDatabaseSelection(Client &client, const char *uri,
CommandResult CommandResult
handle_add(Client &client, Request args, Response &r) handle_add(Client &client, Request args, Response &r)
{ {
auto &partition = client.GetPartition();
const char *uri = args.front(); const char *uri = args.front();
if (StringIsEqual(uri, "/")) if (StringIsEqual(uri, "/"))
/* this URI is malformed, but some clients are buggy /* this URI is malformed, but some clients are buggy
...@@ -101,7 +102,8 @@ handle_add(Client &client, Request args, Response &r) ...@@ -101,7 +102,8 @@ handle_add(Client &client, Request args, Response &r)
return CommandResult::OK; return CommandResult::OK;
case LocatedUri::Type::RELATIVE: case LocatedUri::Type::RELATIVE:
return AddDatabaseSelection(client, located_uri.canonical_uri, return AddDatabaseSelection(partition,
located_uri.canonical_uri,
r); r);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment