@@ -28,6 +28,18 @@ enum EntryType {
2828 PossiblyOwnedFile ( AbsolutePath , RelativePath ) ,
2929}
3030
31+ #[ derive( Debug ) ]
32+ pub enum WalkType {
33+ JWalk ,
34+ Ignore ,
35+ }
36+
37+ #[ derive( Debug ) ]
38+ pub enum EntryProcessorType {
39+ Serial ,
40+ Parallel ,
41+ }
42+
3143#[ derive( Debug ) ]
3244pub struct ProjectBuilder < ' a > {
3345 pub config : & ' a Config ,
@@ -37,10 +49,18 @@ pub struct ProjectBuilder<'a> {
3749 pub teams : Vec < Team > ,
3850 pub codeowners_file_path : PathBuf ,
3951 pub directory_codeowner_files : Vec < DirectoryCodeownersFile > ,
52+ pub walk_type : WalkType ,
53+ pub entry_processor_type : EntryProcessorType ,
4054}
4155
4256impl < ' a > ProjectBuilder < ' a > {
43- pub fn new ( config : & ' a Config , base_path : PathBuf , codeowners_file_path : PathBuf ) -> Self {
57+ pub fn new (
58+ config : & ' a Config ,
59+ base_path : PathBuf ,
60+ codeowners_file_path : PathBuf ,
61+ walk_type : WalkType ,
62+ entry_processor_type : EntryProcessorType ,
63+ ) -> Self {
4464 Self {
4565 config,
4666 base_path,
@@ -49,13 +69,17 @@ impl<'a> ProjectBuilder<'a> {
4969 teams : Vec :: new ( ) ,
5070 codeowners_file_path,
5171 directory_codeowner_files : Vec :: new ( ) ,
72+ walk_type,
73+ entry_processor_type,
5274 }
5375 }
5476
5577 #[ instrument( level = "debug" , skip_all) ]
5678 pub fn build ( & mut self ) -> Result < Project , Error > {
57- self . build_ignore ( )
58- //self.build_jwalk()
79+ match self . walk_type {
80+ WalkType :: Ignore => self . build_ignore ( ) ,
81+ WalkType :: JWalk => self . build_jwalk ( ) ,
82+ }
5983 }
6084
6185 #[ instrument( level = "debug" , skip_all) ]
@@ -71,7 +95,6 @@ impl<'a> ProjectBuilder<'a> {
7195 entry_types. push ( self . build_entry_type_ignore ( entry) ?) ;
7296 }
7397 self . build_project_from_entry_types ( entry_types)
74- //self.build_project_from_entry_types_rayon(entry_types)
7598 }
7699
77100 fn build_entry_type_ignore ( & mut self , entry : ignore:: DirEntry ) -> Result < EntryType , Error > {
@@ -131,6 +154,13 @@ impl<'a> ProjectBuilder<'a> {
131154 }
132155
133156 fn build_project_from_entry_types ( & mut self , entry_types : Vec < EntryType > ) -> Result < Project , Error > {
157+ match self . entry_processor_type {
158+ EntryProcessorType :: Serial => self . build_project_from_entry_types_serial ( entry_types) ,
159+ EntryProcessorType :: Parallel => self . build_project_from_entry_types_rayon ( entry_types) ,
160+ }
161+ }
162+
163+ fn build_project_from_entry_types_serial ( & mut self , entry_types : Vec < EntryType > ) -> Result < Project , Error > {
134164 let mut owned_files_vec = Vec :: new ( ) ;
135165 for entry_type in entry_types {
136166 match entry_type {
0 commit comments