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

Function DfsGetCurrent

src/admincli.cc:836–862  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

834}
835
836int DfsGetCurrent(const std::string& current_path, std::string* content) {
837 if (current_path == "") {
838 LOG(INFO) << "fail, Invalid arguments";
839 return -1;
840 }
841
842 leveldb::DfsFile* file = g_dfs->OpenFile(current_path, leveldb::RDONLY);
843 if (NULL == file) {
844 LOG(INFO) << "fail, open current path(" << current_path.c_str() << ") fail";
845 return errno;
846 }
847
848 // MANIFEST-000000, just 15 char
849 char buf[MANIFEST_LEN] = {0};
850 ssize_t ret_size = 0;
851 ret_size = file->Read(buf, sizeof(buf));
852 if (ret_size > 0) {
853 buf[MANIFEST_LEN - 1] = '\0';
854 *content = buf;
855 } else {
856 *content = "";
857 LOG(INFO) << "fail, read current fail";
858 }
859
860 file->CloseFile();
861 return 0;
862}
863
864int MapOutPutDiff(std::map<std::string, std::vector<std::string>>* map_diff) {
865 // output mutex

Callers 1

GetTabletKeyRangeFunction · 0.85

Calls 3

OpenFileMethod · 0.45
ReadMethod · 0.45
CloseFileMethod · 0.45

Tested by

no test coverage detected