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