| 1169 | |
| 1170 | |
| 1171 | Try<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 | |
| 1198 | Try<Nothing> FetcherProcess::Cache::validate( |
no test coverage detected