+impl SetupCore {
+ #[throws(AE)]
+ pub fn initial_id_by_desc_glob(&mut self, desc_glob: &str) -> PieceId {
+ let pieces = self.initial_pieces_cache.get_or_insert_with(||{
+ self.mgmt_conn.borrow_mut().list_pieces().unwrap().0
+ });
+
+ let glob = glob::Pattern::new(desc_glob).unwrap();
+ pieces.iter().filter_map(|mgpi| {
+
+ let vis = mgpi.visible.as_ref()?;
+ glob.matches(vis.desc_html.as_html_str()).then(||())?;
+ Some(mgpi.piece)
+
+ }).exactly_one().map_err(|_| anyhow!("not exactly one {:?}", desc_glob))?
+ }
+
+ #[throws(AE)]
+ pub fn initial_vpid_by_desc_glob(&mut self, desc_glob: &str) -> String {
+ let id = self.initial_id_by_desc_glob(desc_glob)?;
+ VisiblePieceId::from(id.data()).to_string()
+ }
+}
+