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

Method reserve

src/slave/containerizer/fetcher.cpp:1171–1195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1169
1170
1171Try<Nothing> FetcherProcess::Cache::reserve(
1172 const Bytes& requestedSpace)
1173{
1174 if (availableSpace() < requestedSpace) {
1175 Bytes missingSpace = requestedSpace - availableSpace();
1176
1177 VLOG(1) << "Freeing up fetcher cache space for: " << missingSpace;
1178
1179 const Try<list<shared_ptr<Cache::Entry>>> victims =
1180 selectVictims(missingSpace);
1181
1182 if (victims.isError()) {
1183 return Error("Could not free up enough fetcher cache space");
1184 }
1185
1186 foreach (const shared_ptr<Cache::Entry>& entry, victims.get()) {
1187 Try<Nothing> removal = remove(entry);
1188 if (removal.isError()) {
1189 return Error(removal.error());
1190 }
1191 }
1192 }
1193
1194 return Nothing();
1195}
1196
1197
1198Try<Nothing> FetcherProcess::Cache::validate(

Callers 1

reserveCacheSpaceMethod · 0.45

Calls 3

NothingClass · 0.85
ErrorFunction · 0.50
isErrorMethod · 0.45

Tested by

no test coverage detected