get rids of the new introduced error code in favor of an io::Error

This commit is contained in:
Tamo 2023-10-10 15:12:23 +02:00
parent d772073dfa
commit c0f2724c2d
4 changed files with 7 additions and 19 deletions

View File

@ -47,8 +47,6 @@ pub enum InternalError {
IndexingMergingKeys { process: &'static str },
#[error("{}", HeedError::InvalidDatabaseTyping)]
InvalidDatabaseTyping,
#[error("Could not access the inner of a buf-reader/writer: {0}")]
BufIntoInnerError(String),
#[error(transparent)]
RayonThreadPool(#[from] ThreadPoolBuildError),
#[error(transparent)]

View File

@ -67,10 +67,7 @@ pub fn sorter_into_reader(
pub fn writer_into_reader(
writer: grenad::Writer<BufWriter<File>>,
) -> Result<grenad::Reader<BufReader<File>>> {
let mut file = writer
.into_inner()?
.into_inner()
.map_err(|err| InternalError::BufIntoInnerError(err.to_string()))?;
let mut file = writer.into_inner()?.into_inner().map_err(|err| err.into_error())?;
file.rewind()?;
grenad::Reader::new(BufReader::new(file)).map_err(Into::into)
}

View File

@ -659,12 +659,10 @@ impl<'a, 'i> Transform<'a, 'i> {
new_documents_ids: self.new_documents_ids,
replaced_documents_ids: self.replaced_documents_ids,
documents_count: self.documents_count,
original_documents: original_documents
.into_inner()
.map_err(|err| InternalError::BufIntoInnerError(err.to_string()))?,
original_documents: original_documents.into_inner().map_err(|err| err.into_error())?,
flattened_documents: flattened_documents
.into_inner()
.map_err(|err| InternalError::BufIntoInnerError(err.to_string()))?,
.map_err(|err| err.into_error())?,
})
}
@ -783,12 +781,10 @@ impl<'a, 'i> Transform<'a, 'i> {
new_documents_ids: documents_ids,
replaced_documents_ids: RoaringBitmap::default(),
documents_count,
original_documents: original_documents
.into_inner()
.map_err(|err| InternalError::BufIntoInnerError(err.to_string()))?,
original_documents: original_documents.into_inner().map_err(|err| err.into_error())?,
flattened_documents: flattened_documents
.into_inner()
.map_err(|err| InternalError::BufIntoInnerError(err.to_string()))?,
.map_err(|err| err.into_error())?,
};
let new_facets = output.compute_real_facets(wtxn, self.index)?;

View File

@ -6,7 +6,7 @@ use grenad::CompressionType;
use heed::types::ByteSlice;
use super::index_documents::{merge_cbo_roaring_bitmaps, CursorClonableMmap};
use crate::{Index, InternalError, Result};
use crate::{Index, Result};
mod prefix_word;
mod word_prefix;
@ -121,10 +121,7 @@ pub fn write_into_lmdb_database_without_merging(
database: heed::PolyDatabase,
writer: grenad::Writer<BufWriter<std::fs::File>>,
) -> Result<()> {
let file = writer
.into_inner()?
.into_inner()
.map_err(|err| InternalError::BufIntoInnerError(err.to_string()))?;
let file = writer.into_inner()?.into_inner().map_err(|err| err.into_error())?;
let reader = grenad::Reader::new(BufReader::new(file))?;
if database.is_empty(wtxn)? {
let mut out_iter = database.iter_mut::<_, ByteSlice, ByteSlice>(wtxn)?;