| 974 | } |
| 975 | |
| 976 | virtual Status Read(Slice* result) OVERRIDE { |
| 977 | MAYBE_RETURN_EIO(filename_, IOError(Env::kInjectedFailureStatusMsg, EIO)); |
| 978 | ThreadRestrictions::AssertIOAllowed(); |
| 979 | size_t r; |
| 980 | STREAM_RETRY_ON_EINTR(r, file_, fread_unlocked(result->mutable_data(), 1, |
| 981 | result->size(), file_)); |
| 982 | if (r < result->size()) { |
| 983 | if (feof(file_)) { |
| 984 | // We leave status as ok if we hit the end of the file. |
| 985 | // We need to adjust the slice size. |
| 986 | result->truncate(r); |
| 987 | } else { |
| 988 | // A partial read with an error: return a non-ok status. |
| 989 | return IOError(filename_, errno); |
| 990 | } |
| 991 | } |
| 992 | if (encrypted_) { |
| 993 | RETURN_NOT_OK(DoDecryptV(&encryption_header_, offset_, ArrayView<Slice>(result, 1))); |
| 994 | } |
| 995 | offset_ += r; |
| 996 | return Status::OK(); |
| 997 | } |
| 998 | |
| 999 | virtual Status Skip(uint64_t n) OVERRIDE { |
| 1000 | MAYBE_RETURN_EIO(filename_, IOError(Env::kInjectedFailureStatusMsg, EIO)); |
nothing calls this directly
no test coverage detected