1use std::collections::BTreeSet;
7use std::path::Path;
8
9use crate::error_bridge::IntoCoreResult;
10use crate::errors::CoreResult;
11use ito_common::fs::StdFs;
12
13#[derive(Debug, Default, Clone)]
14pub struct RepoIndex {
16 pub module_dir_names: Vec<String>,
18
19 pub module_ids: BTreeSet<String>,
21
22 pub change_dir_names: Vec<String>,
24
25 pub spec_dir_names: Vec<String>,
27}
28
29impl RepoIndex {
30 pub fn load(ito_path: &Path) -> CoreResult<Self> {
32 let fs = StdFs;
33 let module_dir_names =
34 ito_domain::discovery::list_module_dir_names(&fs, ito_path).into_core()?;
35 let module_ids = ito_domain::discovery::list_module_ids(&fs, ito_path).into_core()?;
36 let change_dir_names =
37 ito_domain::discovery::list_change_dir_names(&fs, ito_path).into_core()?;
38 let spec_dir_names =
39 ito_domain::discovery::list_spec_dir_names(&fs, ito_path).into_core()?;
40
41 Ok(Self {
42 module_dir_names,
43 module_ids,
44 change_dir_names,
45 spec_dir_names,
46 })
47 }
48}