mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-18 05:32:41 -04:00
Use the pool when creating a chunkedwriter.
This commit is contained in:
@@ -115,6 +115,14 @@ impl ChunkedWriter {
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a new `ChunkedWriter` with an empty chunk allocated from the pool.
|
||||
fn new(pool: &mut ChunkPool) -> Self {
|
||||
Self {
|
||||
chunks: Vec::new(),
|
||||
curr: pool.take(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Finalises the writer and returns all the chunks.
|
||||
fn into_chunks(mut self) -> Vec<Vec<u8>> {
|
||||
if !self.curr.is_empty() {
|
||||
@@ -129,7 +137,7 @@ impl ChunkedWriter {
|
||||
rows_scanned: &mut usize,
|
||||
bytes_scanned: &mut usize,
|
||||
) -> Vec<Vec<u8>> {
|
||||
let mut chunked_writer = Self::default();
|
||||
let mut chunked_writer = Self::new(pool);
|
||||
// Consume the iterator, serializing each `item`,
|
||||
// while allowing a chunk to be created at boundaries.
|
||||
for item in iter {
|
||||
|
||||
Reference in New Issue
Block a user