MCPcopy Create free account
hub / github.com/apple/foundationdb / decodeMutationLogKey

Function decodeMutationLogKey

fdbclient/FileBackupAgent.actor.cpp:3246–3261  ·  view source on GitHub ↗

Decodes a mutation log key, which contains (hash, commitVersion, chunkNumber) and returns (commitVersion, chunkNumber)

Source from the content-addressed store, hash-verified

3244// Decodes a mutation log key, which contains (hash, commitVersion, chunkNumber) and
3245// returns (commitVersion, chunkNumber)
3246std::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],

Callers 2

addBlockKVPairsMethod · 0.85
filterLogMutationKVPairsFunction · 0.85

Calls 3

UnversionedFunction · 0.85
hashlittleFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected