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

Method addTask

fdbclient/TaskBucket.actor.cpp:903–927  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

901}
902
903Key TaskBucket::addTask(Reference<ReadYourWritesTransaction> tr, Reference<Task> task) {
904 setOptions(tr);
905
906 Key key(deterministicRandom()->randomUniqueID().toString());
907
908 Subspace taskSpace;
909
910 // If scheduledVersion is valid then place the task directly into the timeout
911 // space for its scheduled time, otherwise place it in the available space by priority.
912 Version scheduledVersion = ReservedTaskParams::scheduledVersion().getOrDefault(task, invalidVersion);
913 if (scheduledVersion != invalidVersion) {
914 taskSpace = timeouts.get(scheduledVersion).get(key);
915 } else {
916 taskSpace = getAvailableSpace(task->getPriority()).get(key);
917 }
918
919 for (auto& param : task->params)
920 tr->set(taskSpace.pack(param.key), param.value);
921
922 tr->atomicOp(prefix.pack(LiteralStringRef("task_count")),
923 LiteralStringRef("\x01\x00\x00\x00\x00\x00\x00\x00"),
924 MutationRef::AddValue);
925
926 return key;
927}
928
929void TaskBucket::setValidationCondition(Reference<Task> task, KeyRef vKey, KeyRef vValue) {
930 task->params[Task::reservedTaskParamValidKey] = vKey;

Callers 6

_finishMethod · 0.45
_finishMethod · 0.45
addInitTasksMethod · 0.45
finishMethod · 0.45
addIdleFunction · 0.45
Future<Key> actorAddTaskFunction · 0.45

Calls 10

deterministicRandomFunction · 0.85
addTaskFunction · 0.85
randomUniqueIDMethod · 0.80
getOrDefaultMethod · 0.80
getMethod · 0.65
setMethod · 0.65
toStringMethod · 0.45
getPriorityMethod · 0.45
packMethod · 0.45
atomicOpMethod · 0.45

Tested by

no test coverage detected