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

Method getNewGeneration

fdbserver/ConfigNode.actor.cpp:229–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227 // New transactions increment the database's current live version. This effectively serves as a lock, providing
228 // serializability
229 ACTOR static Future<Void> getNewGeneration(ConfigNodeImpl* self, ConfigTransactionGetGenerationRequest req) {
230 state ConfigGeneration generation = wait(getGeneration(self));
231 ++generation.liveVersion;
232 if (req.lastSeenLiveVersion.present()) {
233 CODE_PROBE(req.lastSeenLiveVersion.get() >= generation.liveVersion,
234 "Node is lagging behind some other node");
235 generation.liveVersion = std::max(generation.liveVersion, req.lastSeenLiveVersion.get() + 1);
236 }
237 self->kvStore->set(KeyValueRef(currentGenerationKey, BinaryWriter::toValue(generation, IncludeVersion())));
238 wait(self->kvStore->commit());
239 req.reply.send(ConfigTransactionGetGenerationReply{ generation });
240 return Void();
241 }
242
243 ACTOR static Future<Void> get(ConfigNodeImpl* self, ConfigTransactionGetRequest req) {
244 ConfigGeneration currentGeneration = wait(getGeneration(self));

Callers

nothing calls this directly

Calls 9

getGenerationFunction · 0.85
IncludeVersionFunction · 0.85
getMethod · 0.65
setMethod · 0.65
commitMethod · 0.65
KeyValueRefClass · 0.50
VoidClass · 0.50
presentMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected