| 8539 | |
| 8540 | |
| 8541 | Future<Nothing> Slave::garbageCollect(const string& path) |
| 8542 | { |
| 8543 | Try<long> mtime = os::stat::mtime(path); |
| 8544 | if (mtime.isError()) { |
| 8545 | LOG(ERROR) << "Failed to find the mtime of '" << path |
| 8546 | << "': " << mtime.error(); |
| 8547 | return Failure(mtime.error()); |
| 8548 | } |
| 8549 | |
| 8550 | // It is unsafe for testing to use unix time directly, we must use |
| 8551 | // Time::create to convert into a Time object that reflects the |
| 8552 | // possibly advanced state of the libprocess Clock. |
| 8553 | Try<Time> time = Time::create(mtime.get()); |
| 8554 | CHECK_SOME(time); |
| 8555 | |
| 8556 | // GC based on the modification time. |
| 8557 | Duration delay = flags.gc_delay - (Clock::now() - time.get()); |
| 8558 | |
| 8559 | return gc->schedule(delay, path); |
| 8560 | } |
| 8561 | |
| 8562 | |
| 8563 | void Slave::forwardOversubscribed() |