| 290 | } |
| 291 | |
| 292 | Status Write(const uint8_t* buffer, int64_t nbytes) { |
| 293 | RETURN_NOT_OK(CheckClosed()); |
| 294 | |
| 295 | constexpr int64_t kMaxBlockSize = std::numeric_limits<int32_t>::max(); |
| 296 | |
| 297 | std::lock_guard<std::mutex> guard(lock_); |
| 298 | while (nbytes > 0) { |
| 299 | const auto block_size = static_cast<tSize>(std::min(kMaxBlockSize, nbytes)); |
| 300 | tSize ret = driver_->Write(fs_, file_, buffer, block_size); |
| 301 | CHECK_FAILURE(ret, "Write"); |
| 302 | DCHECK_LE(ret, block_size); |
| 303 | buffer += ret; |
| 304 | nbytes -= ret; |
| 305 | } |
| 306 | return Status::OK(); |
| 307 | } |
| 308 | |
| 309 | protected: |
| 310 | Status FlushInternal() { |
nothing calls this directly
no test coverage detected