| 745 | bool MemoryMappedFile::supports_zero_copy() const { return true; } |
| 746 | |
| 747 | Status MemoryMappedFile::WriteAt(int64_t position, const void* data, int64_t nbytes) { |
| 748 | RETURN_NOT_OK(memory_map_->CheckClosed()); |
| 749 | std::lock_guard<std::mutex> guard(memory_map_->write_lock()); |
| 750 | |
| 751 | if (!memory_map_->opened() || !memory_map_->writable()) { |
| 752 | return Status::IOError("Unable to write"); |
| 753 | } |
| 754 | RETURN_NOT_OK(internal::ValidateWriteRange(position, nbytes, memory_map_->size())); |
| 755 | |
| 756 | RETURN_NOT_OK(memory_map_->Seek(position)); |
| 757 | return WriteInternal(data, nbytes); |
| 758 | } |
| 759 | |
| 760 | Status MemoryMappedFile::Write(const void* data, int64_t nbytes) { |
| 761 | RETURN_NOT_OK(memory_map_->CheckClosed()); |