11use std:: path:: PathBuf ;
22
3+ use serde:: { Deserialize , Serialize } ;
4+
35/// CODEOWNERS entry with source tracking
4- #[ derive( Debug ) ]
6+ #[ derive( Debug , Serialize , Deserialize ) ]
57pub struct CodeownersEntry {
68 pub source_file : PathBuf ,
79 pub line_number : usize ,
@@ -11,14 +13,14 @@ pub struct CodeownersEntry {
1113}
1214
1315/// Detailed owner representation
14- #[ derive( Debug , Clone ) ]
16+ #[ derive( Debug , Clone , Serialize , Deserialize , Eq , PartialEq , Hash ) ]
1517pub struct Owner {
1618 pub identifier : String ,
1719 pub owner_type : OwnerType ,
1820}
1921
2022/// Owner type classification
21- #[ derive( Debug , Clone ) ]
23+ #[ derive( Debug , Clone , Serialize , Deserialize , Eq , PartialEq , Hash ) ]
2224pub enum OwnerType {
2325 User ,
2426 Team ,
@@ -28,10 +30,10 @@ pub enum OwnerType {
2830}
2931
3032/// Tag representation
31- #[ derive( Debug , Clone ) ]
33+ #[ derive( Debug , Clone , Serialize , Deserialize , Eq , PartialEq , Hash ) ]
3234pub struct Tag ( pub String ) ;
3335
34- #[ derive( Clone , Debug , PartialEq ) ]
36+ #[ derive( Clone , Debug , Eq , PartialEq ) ]
3537pub enum OutputFormat {
3638 Text ,
3739 Json ,
@@ -47,3 +49,22 @@ impl std::fmt::Display for OutputFormat {
4749 }
4850 }
4951}
52+
53+ // Cache related types
54+ /// File entry in the ownership cache
55+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
56+ pub struct FileEntry {
57+ pub path : PathBuf ,
58+ pub owners : Vec < Owner > ,
59+ pub tags : Vec < Tag > ,
60+ }
61+
62+ /// Cache for storing parsed CODEOWNERS information
63+ #[ derive( Debug , Serialize , Deserialize ) ]
64+ pub struct CodeownersCache {
65+ pub entries : Vec < CodeownersEntry > ,
66+ pub files : Vec < FileEntry > ,
67+ // Derived data for lookups
68+ pub owners_map : std:: collections:: HashMap < Owner , Vec < PathBuf > > ,
69+ pub tags_map : std:: collections:: HashMap < Tag , Vec < PathBuf > > ,
70+ }
0 commit comments