command/queue: pass Partition to AddDatabaseSelection()
This commit is contained in:
parent
c8121176b3
commit
293ed924d1
@ -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,
|
|||||||
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)
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user