| 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]+)?"); |
| 109 | static const std::regex BUCKET_PATTERN("bucket_([0-9]+)(_[0-9]+)?"); |
| 110 | |
| 111 | string filename = GetFileName(file_path); |
| 112 | int bucket_id = 0; |
| 113 | if (std::regex_match(filename, ORIGINAL_PATTERN)) { |
| 114 | bucket_id = std::atoi(filename.c_str()); |
| 115 | } else if (std::regex_match(filename, BUCKET_PATTERN)) { |
| 116 | bucket_id = std::atoi(filename.c_str() + sizeof("bucket_")); |
| 117 | } else { |
| 118 | return -1; |
| 119 | } |
| 120 | int statement_id = GetStatementId(file_path); |
| 121 | |
| 122 | constexpr int BUCKET_CODEC_VERSION = 1; |
| 123 | constexpr int NUM_BUCKET_ID_BITS = 12; |
| 124 | constexpr int NUM_STATEMENT_ID_BITS = 12; |
| 125 | return BUCKET_CODEC_VERSION << (1 + NUM_BUCKET_ID_BITS + 4 + NUM_STATEMENT_ID_BITS) | |
| 126 | bucket_id << (4 + NUM_STATEMENT_ID_BITS) | |
| 127 | statement_id; |
| 128 | } |
| 129 | |
| 130 | void ValidWriteIdList::InitFrom(const TValidWriteIdList& valid_write_ids) { |
| 131 | if (valid_write_ids.__isset.high_watermark) { |
nothing calls this directly
no test coverage detected