Decodes a mutation log key, which contains (hash, commitVersion, chunkNumber) and returns (commitVersion, chunkNumber)
| 3244 | // Decodes a mutation log key, which contains (hash, commitVersion, chunkNumber) and |
| 3245 | // returns (commitVersion, chunkNumber) |
| 3246 | std::pair<Version, int32_t> decodeMutationLogKey(const StringRef& key) { |
| 3247 | ASSERT(key.size() == sizeof(uint8_t) + sizeof(Version) + sizeof(int32_t)); |
| 3248 | |
| 3249 | uint8_t hash; |
| 3250 | Version version; |
| 3251 | int32_t part; |
| 3252 | BinaryReader rd(key, Unversioned()); |
| 3253 | rd >> hash >> version >> part; |
| 3254 | version = bigEndian64(version); |
| 3255 | part = bigEndian32(part); |
| 3256 | |
| 3257 | int32_t v = version / CLIENT_KNOBS->LOG_RANGE_BLOCK_SIZE; |
| 3258 | ASSERT(((uint8_t)hashlittle(&v, sizeof(v), 0)) == hash); |
| 3259 | |
| 3260 | return std::make_pair(version, part); |
| 3261 | } |
| 3262 | |
| 3263 | // Decodes an encoded list of mutations in the format of: |
| 3264 | // [includeVersion:uint64_t][val_length:uint32_t][mutation_1][mutation_2]...[mutation_k], |
no test coverage detected