Esempio n. 1
0
// 全テーブルを取得し、string t と一致するテーブルのみを削除
static void
initTableFunc(std::string t, HbaseClient client)
{
    std::cout << "scanning tables..." << std::endl;
    StrVec tables;
    client.getTableNames(tables);
    for (StrVec::const_iterator it = tables.begin(); it != tables.end(); ++it) {
      std::cout << "  found: " << *it << std::endl;
      if (t == *it) {
        if (client.isTableEnabled(*it)) {
          std::cout << "    disabling table: " << *it << std::endl;
          client.disableTable(*it);
        }
        std::cout << "    deleting table: " << *it << std::endl;
        client.deleteTable(*it);
      }
    }
}
Esempio n. 2
0
/**
Print info about table name + Y if enabled (N if not)
*/
void printTablesStatus(HbaseClient &client) {
    std::vector<std::string> table_names;
    client.getTableNames(table_names);
    auto f = [&] (std::string &s, int& acc)
    {
        std::string enabled = " N";
        if(client.isTableEnabled(s)) {
            enabled = " Y";
            std::cout<<acc<<" Table "<<s<<" - "<<enabled<<std::endl;

        }
        std::vector<TRegionInfo> regionOfTable;
        client.getTableRegions(regionOfTable,s);
        print(regionOfTable.begin(),regionOfTable.end() , 100000,"\n");
        return ++acc;

    };

    int a = fold(table_names.begin(),table_names.end(),0, f);
    std::cout<<"Velue is "<<a<<std::endl;
}