| 199 | } |
| 200 | |
| 201 | void TableBuilder::WriteRawBlock(const StringPiece& block_contents, |
| 202 | CompressionType type, BlockHandle* handle) { |
| 203 | Rep* r = rep_; |
| 204 | handle->set_offset(r->offset); |
| 205 | handle->set_size(block_contents.size()); |
| 206 | r->status = r->file->Append(block_contents); |
| 207 | if (r->status.ok()) { |
| 208 | char trailer[kBlockTrailerSize]; |
| 209 | trailer[0] = type; |
| 210 | uint32 crc = crc32c::Value(block_contents.data(), block_contents.size()); |
| 211 | crc = crc32c::Extend(crc, trailer, 1); // Extend crc to cover block type |
| 212 | core::EncodeFixed32(trailer + 1, crc32c::Mask(crc)); |
| 213 | r->status = r->file->Append(StringPiece(trailer, kBlockTrailerSize)); |
| 214 | if (r->status.ok()) { |
| 215 | r->offset += block_contents.size() + kBlockTrailerSize; |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | Status TableBuilder::status() const { return rep_->status; } |
| 221 |
nothing calls this directly
no test coverage detected