Simplify implementation of ContactStore::all_contacts()
This way we alter the underlying iterator for all contacts to only iterate in the "contact" collection of the store, which results in fewer disk access because the internal iterator does not yield all pathes from the store before filtering them. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
eed577db15
commit
c29e05bc25
1 changed files with 1 additions and 9 deletions
|
@ -77,15 +77,7 @@ impl<'a> ContactStore<'a> for Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn all_contacts(&'a self) -> Result<StoreIdIterator> {
|
fn all_contacts(&'a self) -> Result<StoreIdIterator> {
|
||||||
let iter = self
|
self.entries().map(|iter| iter.in_collection("contact").without_store())
|
||||||
.entries()?
|
|
||||||
.without_store()
|
|
||||||
.filter(|id| match *id {
|
|
||||||
Ok(ref id) => id.is_in_collection(&["contact"]),
|
|
||||||
Err(_) => true,
|
|
||||||
});
|
|
||||||
|
|
||||||
Ok(StoreIdIterator::new(Box::new(iter)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue