while retrieving the readers on an arroywrapper, stops at the first empty reader

This commit is contained in:
Tamo 2024-09-24 16:33:17 +02:00
parent 7f048b9732
commit b31e9bea26

View File

@ -56,7 +56,11 @@ impl ArroyWrapper {
) -> impl Iterator<Item = Result<arroy::Reader<D>, arroy::Error>> + 'a { ) -> impl Iterator<Item = Result<arroy::Reader<D>, arroy::Error>> + 'a {
arroy_db_range_for_embedder(self.embedder_index).map_while(move |index| { arroy_db_range_for_embedder(self.embedder_index).map_while(move |index| {
match arroy::Reader::open(rtxn, index, db) { match arroy::Reader::open(rtxn, index, db) {
Ok(reader) => Some(Ok(reader)), Ok(reader) => match reader.is_empty(rtxn) {
Ok(false) => Some(Ok(reader)),
Ok(true) => None,
Err(e) => Some(Err(e)),
},
Err(arroy::Error::MissingMetadata(_)) => None, Err(arroy::Error::MissingMetadata(_)) => None,
Err(e) => Some(Err(e)), Err(e) => Some(Err(e)),
} }