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

Function InitDfsClient

src/admincli.cc:1182–1210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1180}
1181
1182int InitDfsClient() {
1183 if (g_dfs != NULL) {
1184 return 0;
1185 }
1186 if (FLAGS_tera_leveldb_env_dfs_type == "nfs") {
1187 if (access(FLAGS_tera_leveldb_env_nfs_conf_path.c_str(), R_OK) == 0) {
1188 LOG(INFO) << "init nfs system: use configure file" << FLAGS_tera_leveldb_env_nfs_conf_path;
1189 leveldb::Nfs::Init(FLAGS_tera_leveldb_env_nfs_mountpoint,
1190 FLAGS_tera_leveldb_env_nfs_conf_path);
1191 g_dfs = leveldb::Nfs::GetInstance();
1192 } else {
1193 LOG(ERROR) << "init nfs system: no configure file found";
1194 return -1;
1195 }
1196 } else if (FLAGS_tera_leveldb_env_dfs_type == "hdfs2") {
1197 LOG(INFO) << "init hdfs2 file system";
1198 g_dfs = new leveldb::Hdfs2(FLAGS_tera_leveldb_env_hdfs2_nameservice_list);
1199 } else if (FLAGS_tera_leveldb_env_dfs_type == "hdfs") {
1200 g_dfs = new leveldb::Hdfs();
1201 } else {
1202 LOG(INFO) << "init dfs system: " << FLAGS_tera_dfs_so_path << "(" << FLAGS_tera_dfs_conf << ")";
1203 g_dfs = leveldb::Dfs::NewDfs(FLAGS_tera_dfs_so_path, FLAGS_tera_dfs_conf);
1204 }
1205
1206 if (g_dfs == NULL) {
1207 return -1;
1208 }
1209 return 0;
1210}
1211
1212CliStatus AllDiff(const std::string& prefix_path) {
1213 int ret = DfsListDir(prefix_path, &g_tables);

Callers 2

MetaDiffOpFunction · 0.70
MetaHealthCheckOpFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected