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

Method remove

src/slave/containerizer/fetcher.cpp:1110–1145  ·  view source on GitHub ↗

We are removing an entry if: (1) We failed to determine its prospective cache file size. (2) We failed to download it when invoking the mesos-fetcher. (3) We're evicting it to make room for another entry. (4) We failed to validate the cache file. In (1) and (2) the contract is that we'll have failed the entry's future before we call remove, so the entry's future should no longer be pending. In

Source from the content-addressed store, hash-verified

1108// no new download conflicts with the manipulation of any pre-existing
1109// cache content.
1110Try<Nothing> FetcherProcess::Cache::remove(
1111 const shared_ptr<Cache::Entry>& entry)
1112{
1113 VLOG(1) << "Removing cache entry '" << entry->key
1114 << "' with filename: " << entry->filename;
1115
1116 CHECK(!entry->completion().isPending());
1117
1118 CHECK(contains(entry));
1119
1120 table.erase(entry->key);
1121 lruSortedEntries.remove(entry);
1122
1123 // We may or may not have started downloading. The download may or may
1124 // not have been partial. In any case, clean up whatever is there.
1125 if (os::exists(entry->path().string())) {
1126 Try<Nothing> rm = os::rm(entry->path().string());
1127 if (rm.isError()) {
1128 return Error("Could not delete fetcher cache file '" +
1129 entry->path().string() + "' with error: " + rm.error() +
1130 " for entry '" + entry->key +
1131 "', leaking cache space: " + stringify(entry->size));
1132 }
1133 }
1134
1135 // NOTE: There is an assumption that if and only if 'entry->size > 0'
1136 // then we've claimed cache space for this entry! This currently only
1137 // gets set in reserveCacheSpace().
1138 if (entry->size > 0) {
1139 releaseSpace(entry->size);
1140
1141 entry->size = 0;
1142 }
1143
1144 return Nothing();
1145}
1146
1147
1148// Select LRU cache entries for cache eviction.

Callers 3

foreachvalueFunction · 0.45
reserveCacheSpaceMethod · 0.45
getMethod · 0.45

Calls 13

NothingClass · 0.85
completionMethod · 0.80
errorMethod · 0.65
containsFunction · 0.50
existsFunction · 0.50
rmFunction · 0.50
ErrorFunction · 0.50
stringifyFunction · 0.50
isPendingMethod · 0.45
eraseMethod · 0.45
stringMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected