MCPcopy Create free account
hub / github.com/ElementsProject/elements / WriteRawBlock

Method WriteRawBlock

src/leveldb/table/table_builder.cc:177–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177void TableBuilder::WriteRawBlock(const Slice& block_contents,
178 CompressionType type, BlockHandle* handle) {
179 Rep* r = rep_;
180 handle->set_offset(r->offset);
181 handle->set_size(block_contents.size());
182 r->status = r->file->Append(block_contents);
183 if (r->status.ok()) {
184 char trailer[kBlockTrailerSize];
185 trailer[0] = type;
186 uint32_t crc = crc32c::Value(block_contents.data(), block_contents.size());
187 crc = crc32c::Extend(crc, trailer, 1); // Extend crc to cover block type
188 EncodeFixed32(trailer + 1, crc32c::Mask(crc));
189 r->status = r->file->Append(Slice(trailer, kBlockTrailerSize));
190 if (r->status.ok()) {
191 r->offset += block_contents.size() + kBlockTrailerSize;
192 }
193 }
194}
195
196Status TableBuilder::status() const { return rep_->status; }
197

Callers

nothing calls this directly

Calls 10

ValueFunction · 0.85
EncodeFixed32Function · 0.85
set_offsetMethod · 0.80
set_sizeMethod · 0.80
ExtendFunction · 0.50
MaskFunction · 0.50
SliceClass · 0.50
sizeMethod · 0.45
AppendMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected