MCPcopy Create free account
hub / github.com/baidu/tera / MetaGetOp

Function MetaGetOp

src/admincli.cc:1460–1488  ·  view source on GitHub ↗

get [inmem]

Source from the content-addressed store, hash-verified

1458
1459// get [inmem] <table_name> <start_key>
1460CliStatus MetaGetOp(Client* client, int32_t argc, std::string* argv, ErrorCode* err) {
1461 scoped_ptr<tera::sdk::ClusterFinder> finder(tera::sdk::NewClusterFinder());
1462 const std::string meta_server = finder->RootTableAddr();
1463 if (argc == 4) {
1464 common::ThreadPool thread_pool(1);
1465 const std::string& table_name = argv[2];
1466 const std::string& start_key = argv[3];
1467 return GetMeta(meta_server, &thread_pool, table_name, start_key);
1468 } else if (argc == 5 && argv[2] == "inmem") {
1469 const std::string& table_name = argv[3];
1470 const std::string& start_key = argv[4];
1471
1472 TableMeta table_meta;
1473 TabletMetaList tablet_list;
1474 std::shared_ptr<tera::ClientImpl> client_impl(
1475 (static_cast<ClientWrapper*>(client))->GetClientImpl());
1476 client_impl->ShowTablesInfo(table_name, &table_meta, &tablet_list, err);
1477
1478 for (int i = 0; i < tablet_list.meta_size(); ++i) {
1479 if (tablet_list.meta(i).key_range().key_start() == start_key) {
1480 PrintMetaInfo(&tablet_list.meta(i));
1481 break;
1482 }
1483 }
1484 } else {
1485 PrintCmdHelpInfo(argv[1]);
1486 }
1487 return CliStatus::kOk;
1488}
1489
1490// show [inmem] [start_key] [end_key]
1491CliStatus MetaShowOp(Client* client, int32_t argc, std::string* argv, ErrorCode* err) {

Callers

nothing calls this directly

Calls 7

NewClusterFinderFunction · 0.85
GetMetaFunction · 0.85
PrintMetaInfoFunction · 0.85
RootTableAddrMethod · 0.80
GetClientImplMethod · 0.80
ShowTablesInfoMethod · 0.80
PrintCmdHelpInfoFunction · 0.70

Tested by

no test coverage detected