| 84 | } |
| 85 | |
| 86 | int ValidWriteIdList::GetStatementId(const std::string& file_path) { |
| 87 | string dir_name = GetParentDirName(file_path); |
| 88 | // Only delta directories can have a statement id. |
| 89 | if (StrStartsWith(dir_name, BASE_PREFIX)) return 0; |
| 90 | // Expected number of '_' if statement id is present. |
| 91 | int expected_underscores = 0; |
| 92 | if (StrStartsWith(dir_name, DELTA_PREFIX)) { |
| 93 | expected_underscores = 3; |
| 94 | } else if (StrStartsWith(dir_name, DELETE_DELTA_PREFIX)) { |
| 95 | expected_underscores = 4; |
| 96 | } else { |
| 97 | return 0; |
| 98 | } |
| 99 | int count_underscores = std::count(dir_name.begin(), dir_name.end(), '_'); |
| 100 | if (count_underscores != expected_underscores || dir_name.find("_v") != string::npos) { |
| 101 | return 0; |
| 102 | } |
| 103 | int last_underscore_pos = dir_name.rfind('_'); |
| 104 | return std::atoi(dir_name.c_str() + last_underscore_pos + 1); |
| 105 | } |
| 106 | |
| 107 | int ValidWriteIdList::GetBucketProperty(const std::string& file_path) { |
| 108 | static const std::regex ORIGINAL_PATTERN("[0-9]+_[0-9]+(_copy_[0-9]+)?"); |
nothing calls this directly
no test coverage detected