MCPcopy Create free account
hub / github.com/apache/paimon-rust / write_block_data

Method write_block_data

crates/paimon/src/btree/sst_file.rs:117–134  ·  view source on GitHub ↗

Write a data block: compress, compute CRC, write block + trailer.

(&mut self)

Source from the content-addressed store, hash-verified

115
116 /// Write a data block: compress, compute CRC, write block + trailer.
117 async fn write_block_data(&mut self) -> io::Result<BlockHandle> {
118 let block = self.data_block_writer.finish();
119
120 let (final_data, block_compression_type) = self.maybe_compress(&block);
121
122 let crc = compute_crc32(&final_data, block_compression_type);
123 let trailer = BlockTrailer {
124 compression_type: block_compression_type,
125 crc32c: crc,
126 };
127
128 let block_handle = BlockHandle::new(self.bytes_written, final_data.len() as u32);
129
130 self.write_bytes(&final_data).await?;
131 self.write_bytes(&trailer.to_bytes()).await?;
132
133 Ok(block_handle)
134 }
135
136 fn maybe_compress<'a>(&self, block: &'a [u8]) -> (Cow<'a, [u8]>, BlockCompressionType) {
137 match self.compression_type {

Callers 1

flushMethod · 0.80

Calls 6

compute_crc32Function · 0.85
maybe_compressMethod · 0.80
write_bytesMethod · 0.80
to_bytesMethod · 0.80
finishMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected