| 169 | } |
| 170 | |
| 171 | uint64_t SpillWriteFile::write(std::unique_ptr<folly::IOBuf> iobuf) { |
| 172 | auto writtenBytes = iobuf->computeChainDataLength(); |
| 173 | if (spillUringEnabled_ && file_->uringEnabled()) { |
| 174 | while (iobuf) { |
| 175 | auto current = std::move(iobuf); |
| 176 | iobuf = current->pop(); |
| 177 | auto taskId = taskId_++; |
| 178 | auto writeBuff = writeBuffers_->add(current, taskId, file_); |
| 179 | file_->submitWrite(writeBuff, taskId); |
| 180 | } |
| 181 | } else { |
| 182 | file_->append(std::move(iobuf)); |
| 183 | } |
| 184 | return writtenBytes; |
| 185 | } |
| 186 | |
| 187 | uint64_t SpillWriteFile::write(std::string_view buf) { |
| 188 | auto writtenBytes = buf.size(); |