Prepend a hash to an object name for better performance in GCS.
| 142 | |
| 143 | /// Prepend a hash to an object name for better performance in GCS. |
| 144 | std::string hashed_name(bool use_hash_prefix, std::string object_name) { |
| 145 | if (not use_hash_prefix) return std::move(object_name); |
| 146 | |
| 147 | // Just use the last 32-bits of the hash |
| 148 | auto const hash = crc32c::Crc32c(object_name); |
| 149 | |
| 150 | char buf[16]; |
| 151 | std::snprintf(buf, sizeof(buf), "%08x_", hash); |
| 152 | return buf + object_name; |
| 153 | } |
| 154 | |
| 155 | struct work_item { |
| 156 | std::string bucket; |