kevy_embedded/
ops_index_admin.rs1use kevy_index::IndexKind;
5
6use crate::KevyResult;
7use crate::ops_index::SegmentStats;
8use crate::store::Store;
9
10impl Store {
11 pub fn idx_stats(&self, name: &[u8]) -> KevyResult<SegmentStats> {
14 let mut sum = SegmentStats::default();
15 self.for_each_segment(name, |seg| {
16 let s = seg.stats();
17 sum.entries += s.entries;
18 sum.approx_bytes += s.approx_bytes;
19 sum.coerce_failures += s.coerce_failures;
20 sum.duplicates += s.duplicates;
21 })?;
22 Ok(sum)
23 }
24
25 pub fn idx_list(&self) -> Vec<(Vec<u8>, Vec<u8>, IndexKind)> {
27 let g = self
28 .indexes
29 .catalog
30 .read()
31 .unwrap_or_else(std::sync::PoisonError::into_inner);
32 g.1.iter()
33 .map(|(s, _)| (s.name.clone(), s.prefix.clone(), s.kind))
34 .collect()
35 }
36}