mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-06-04 09:30:42 +00:00
Update src/store/writer.rs
Co-authored-by: Paul Masurel <paul@quickwit.io>
This commit is contained in:
@@ -101,17 +101,20 @@ impl StoreWriter {
|
||||
|
||||
/// Flushes current uncompressed block and sends to compressor.
|
||||
fn send_current_block_to_compressor(&mut self) -> io::Result<()> {
|
||||
// We don't do anything if the current block is empty to begin with.
|
||||
if self.current_block.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
let block = DocumentBlock {
|
||||
data: self.current_block.to_owned(),
|
||||
num_docs_in_block: self.num_docs_in_current_block,
|
||||
};
|
||||
self.current_block.clear();
|
||||
self.num_docs_in_current_block = 0;
|
||||
if !block.is_empty() {
|
||||
self.compressor_sender
|
||||
.send(BlockCompressorMessage::AddBlock(block))
|
||||
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))?;
|
||||
}
|
||||
self.compressor_sender
|
||||
.send(BlockCompressorMessage::AddBlock(block))
|
||||
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -191,12 +194,6 @@ struct DocumentBlock {
|
||||
num_docs_in_block: DocId,
|
||||
}
|
||||
|
||||
impl DocumentBlock {
|
||||
fn is_empty(&self) -> bool {
|
||||
self.data.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
impl BlockCompressor {
|
||||
fn new(compressor: Compressor, writer: WritePtr) -> Self {
|
||||
Self {
|
||||
|
||||
Reference in New Issue
Block a user