MCPcopy Create free account
hub / github.com/apache/incubator-pegasus / register_commands

Method register_commands

src/runtime/task/task_code.cpp:43–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41namespace utils {
42template <>
43void task_code_mgr::register_commands()
44{
45 _cmds.emplace_back(command_manager::instance().register_command(
46 {"task-code"},
47 "task-code - query task code containing any given keywords",
48 "task-code keyword1 keyword2 ...",
49 [](const std::vector<std::string> &args) {
50 std::stringstream ss;
51
52 for (int code = 0; code <= dsn::task_code::max(); code++) {
53 if (code == TASK_CODE_INVALID)
54 continue;
55
56 std::string codes = dsn::task_code(code).to_string();
57 if (args.size() == 0) {
58 ss << " " << codes << std::endl;
59 } else {
60 for (auto &arg : args) {
61 if (codes.find(arg.c_str()) != std::string::npos) {
62 ss << " " << codes << std::endl;
63 }
64 }
65 }
66 }
67 return ss.str();
68 }));
69}
70}
71
72/*static*/

Callers

nothing calls this directly

Calls 6

register_commandMethod · 0.80
strMethod · 0.80
task_codeClass · 0.70
to_stringMethod · 0.45
sizeMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected