MCPcopy Create free account
hub / github.com/apache/mesos / schedule

Method schedule

src/slave/gc.cpp:91–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89
90
91Future<Nothing> GarbageCollectorProcess::schedule(
92 const Duration& d,
93 const string& path)
94{
95 LOG(INFO) << "Scheduling '" << path << "' for gc " << d << " in the future";
96
97 // If there's an existing schedule for this path, we must remove
98 // it here in order to reschedule.
99 if (timeouts.contains(path)) {
100 return unschedule(path)
101 .then(defer(
102 self(),
103 &Self::schedule,
104 d,
105 path));
106 }
107
108 Timeout removalTime = Timeout::in(d);
109
110 timeouts[path] = removalTime;
111
112 Owned<PathInfo> info(new PathInfo(path));
113
114 paths.put(removalTime, info);
115
116 // If the timer is not yet initialized or the timeout is sooner than
117 // the currently active timer, update it.
118 if (timer.timeout().remaining() == Seconds(0) ||
119 removalTime < timer.timeout()) {
120 reset(); // Schedule the timer for next event.
121 }
122
123 return info->promise.future();
124}
125
126
127Future<bool> GarbageCollectorProcess::unschedule(const string& path)

Callers 5

TEST_PFunction · 0.45
TEST_FFunction · 0.45
garbageCollectMethod · 0.45
connectedMethod · 0.45

Calls 10

deferFunction · 0.85
SecondsClass · 0.85
resetFunction · 0.85
dispatchFunction · 0.50
containsMethod · 0.45
thenMethod · 0.45
putMethod · 0.45
remainingMethod · 0.45
timeoutMethod · 0.45
futureMethod · 0.45

Tested by 3

TEST_PFunction · 0.36
TEST_FFunction · 0.36
connectedMethod · 0.36