| 834 | } |
| 835 | |
| 836 | int 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 | |
| 864 | int MapOutPutDiff(std::map<std::string, std::vector<std::string>>* map_diff) { |
| 865 | // output mutex |
no test coverage detected