| 86 | } |
| 87 | |
| 88 | Status WriteableCacheFile::Append(const Slice& val) { |
| 89 | uint64_t i = 0; |
| 90 | |
| 91 | Status s; |
| 92 | while (!(s = cache_->MakeRoomForWrite(val.size())).ok()) { |
| 93 | Env::Default()->SleepForMicroseconds(kRetryIntervalUs); |
| 94 | if (i++ >= write_retry_times_) { |
| 95 | cache_->GetStats()->cache_errors.Inc(); |
| 96 | return s; |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | s = file_->Append(val); |
| 101 | cache_->GetStats()->write_count.Inc(); |
| 102 | |
| 103 | if (s.ok()) { |
| 104 | cache_->GetStats()->write_throughput.Add(val.size()); |
| 105 | } else { |
| 106 | cache_->GetStats()->cache_errors.Inc(); |
| 107 | } |
| 108 | |
| 109 | return s; |
| 110 | } |
| 111 | |
| 112 | void WriteableCacheFile::Close(const Slice& key) { |
| 113 | file_.reset(); |
nothing calls this directly
no test coverage detected