mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 18:02:31 +08:00
Update fdbcli quota usage output
This commit is contained in:
parent
99d243197e
commit
308e0113a8
@ -130,7 +130,14 @@ ACTOR Future<Void> setQuota(Reference<IDatabase> db,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr auto usage = "Usage: quota [get|set] <tag> [reserved|total] [read|write] <value>\n";
|
constexpr auto usage =
|
||||||
|
"quota [get <tag> [reserved|total] [read|write]|set <tag> [reserved|total] [read|write] <value>]";
|
||||||
|
|
||||||
|
bool exitFailure() {
|
||||||
|
fmt::print(usage);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace fdb_cli {
|
namespace fdb_cli {
|
||||||
@ -138,38 +145,32 @@ namespace fdb_cli {
|
|||||||
ACTOR Future<bool> quotaCommandActor(Reference<IDatabase> db, std::vector<StringRef> tokens) {
|
ACTOR Future<bool> quotaCommandActor(Reference<IDatabase> db, std::vector<StringRef> tokens) {
|
||||||
state bool result = true;
|
state bool result = true;
|
||||||
if (tokens.size() != 5 && tokens.size() != 6) {
|
if (tokens.size() != 5 && tokens.size() != 6) {
|
||||||
printf(usage);
|
return exitFailure();
|
||||||
return false;
|
|
||||||
} else {
|
} else {
|
||||||
auto tag = parseTag(tokens[2]);
|
auto tag = parseTag(tokens[2]);
|
||||||
auto limitType = parseLimitType(tokens[3]);
|
auto limitType = parseLimitType(tokens[3]);
|
||||||
auto opType = parseOpType(tokens[4]);
|
auto opType = parseOpType(tokens[4]);
|
||||||
if (!tag.present() || !limitType.present() || !opType.present()) {
|
if (!tag.present() || !limitType.present() || !opType.present()) {
|
||||||
printf(usage);
|
return exitFailure();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
if (tokens[1] == "get"_sr) {
|
if (tokens[1] == "get"_sr) {
|
||||||
if (tokens.size() != 5) {
|
if (tokens.size() != 5) {
|
||||||
printf(usage);
|
return exitFailure();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
wait(getQuota(db, tag.get(), limitType.get(), opType.get()));
|
wait(getQuota(db, tag.get(), limitType.get(), opType.get()));
|
||||||
return true;
|
return true;
|
||||||
} else if (tokens[1] == "set"_sr) {
|
} else if (tokens[1] == "set"_sr) {
|
||||||
if (tokens.size() != 6) {
|
if (tokens.size() != 6) {
|
||||||
printf(usage);
|
return exitFailure();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
auto const limitValue = parseLimitValue(tokens[5]);
|
auto const limitValue = parseLimitValue(tokens[5]);
|
||||||
if (!limitValue.present()) {
|
if (!limitValue.present()) {
|
||||||
printf(usage);
|
return exitFailure();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
wait(setQuota(db, tag.get(), limitType.get(), opType.get(), limitValue.get()));
|
wait(setQuota(db, tag.get(), limitType.get(), opType.get(), limitValue.get()));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
printf(usage);
|
return exitFailure();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -508,9 +508,10 @@ void initHelp() {
|
|||||||
CommandHelp("getversion",
|
CommandHelp("getversion",
|
||||||
"Fetch the current read version",
|
"Fetch the current read version",
|
||||||
"Displays the current read version of the database or currently running transaction.");
|
"Displays the current read version of the database or currently running transaction.");
|
||||||
helpMap["quota"] = CommandHelp("quota",
|
helpMap["quota"] =
|
||||||
"quota [get|set] <tag> [reserved|total] [read|write] <value>",
|
CommandHelp("quota",
|
||||||
"Get or modify the throughput quota for the specified tag.");
|
"quota [get <tag> [reserved|total] [read|write]|set <tag> [reserved|total] [read|write] <value>]",
|
||||||
|
"Get or modify the throughput quota for the specified tag.");
|
||||||
helpMap["reset"] =
|
helpMap["reset"] =
|
||||||
CommandHelp("reset",
|
CommandHelp("reset",
|
||||||
"reset the current transaction",
|
"reset the current transaction",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user