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

Method put

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

Put a key-value pair. Keys must be monotonically increasing.

(&mut self, key: &[u8], value: &[u8])

Source from the content-addressed store, hash-verified

80
81 /// Put a key-value pair. Keys must be monotonically increasing.
82 pub async fn put(&mut self, key: &[u8], value: &[u8]) -> io::Result<()> {
83 self.data_block_writer.add(key, value);
84
85 // Only clone key if it changed
86 match &self.last_key {
87 Some(last) if last.as_slice() == key => {}
88 _ => {
89 self.last_key = Some(key.to_vec());
90 }
91 }
92
93 if self.data_block_writer.memory() > self.block_size {
94 self.flush().await?;
95 }
96
97 self.record_count += 1;
98 Ok(())
99 }
100
101 /// Flush the current data block to output.
102 pub async fn flush(&mut self) -> io::Result<()> {

Callers 5

test_sst_file_roundtripFunction · 0.80
flush_row_idsMethod · 0.80
test_parse_ocf_roundtripFunction · 0.80
test_parse_ocf_zstdFunction · 0.80
test_parse_ocf_snappyFunction · 0.80

Calls 4

to_vecMethod · 0.80
memoryMethod · 0.80
addMethod · 0.45
flushMethod · 0.45

Tested by 4

test_sst_file_roundtripFunction · 0.64
test_parse_ocf_roundtripFunction · 0.64
test_parse_ocf_zstdFunction · 0.64
test_parse_ocf_snappyFunction · 0.64