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

Method selectRandomKey

fdbserver/workloads/ApiWorkload.actor.cpp:269–274  ·  view source on GitHub ↗

Selects a random key. There is a probability that the key will be chosen from the keyset in data, otherwise the key will be a randomly generated key

Source from the content-addressed store, hash-verified

267// Selects a random key. There is a <probabilityKeyExists> probability that the key will be chosen from the keyset in
268// data, otherwise the key will be a randomly generated key
269Key ApiWorkload::selectRandomKey(VectorRef<KeyValueRef> const& data, double probabilityKeyExists) {
270 if (deterministicRandom()->random01() < probabilityKeyExists)
271 return data[deterministicRandom()->randomInt(0, data.size())].key;
272 else
273 return generateKey(data, minLongKeyLength, maxLongKeyLength, clientPrefix);
274}
275
276// Generates a random value
277Value ApiWorkload::generateValue(int minValueLength, int maxValueLength) {

Callers 4

Future<bool> runGetFunction · 0.80
Future<bool> runGetRangeFunction · 0.80
Future<bool> runClearFunction · 0.80

Calls 4

deterministicRandomFunction · 0.85
random01Method · 0.80
randomIntMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected