@@ -66,7 +66,7 @@ impl OutputMode {
66
66
}
67
67
68
68
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Default ) ]
69
- pub struct CommandCacheKey {
69
+ pub struct CommandFingerprint {
70
70
program : OsString ,
71
71
args : Vec < OsString > ,
72
72
envs : Vec < ( OsString , Option < OsString > ) > ,
@@ -80,11 +80,11 @@ pub struct CommandProfile {
80
80
81
81
#[ derive( Default ) ]
82
82
pub struct CommandProfiler {
83
- stats : Mutex < HashMap < CommandCacheKey , CommandProfile > > ,
83
+ stats : Mutex < HashMap < CommandFingerprint , CommandProfile > > ,
84
84
}
85
85
86
86
impl CommandProfiler {
87
- pub fn record_execution ( & self , key : CommandCacheKey , start_time : Instant ) {
87
+ pub fn record_execution ( & self , key : CommandFingerprint , start_time : Instant ) {
88
88
let mut stats = self . stats . lock ( ) . unwrap ( ) ;
89
89
let entry = stats. entry ( key) . or_default ( ) ;
90
90
entry. traces . push ( ExecutionTrace :: Executed {
@@ -93,7 +93,7 @@ impl CommandProfiler {
93
93
} ) ;
94
94
}
95
95
96
- pub fn record_cache_hit ( & self , key : CommandCacheKey ) {
96
+ pub fn record_cache_hit ( & self , key : CommandFingerprint ) {
97
97
let mut stats = self . stats . lock ( ) . unwrap ( ) ;
98
98
let entry = stats. entry ( key) . or_default ( ) ;
99
99
entry. traces . push ( ExecutionTrace :: CacheHit { timestamp : Instant :: now ( ) } ) ;
@@ -316,9 +316,9 @@ impl<'a> BootstrapCommand {
316
316
}
317
317
}
318
318
319
- pub fn cache_key ( & self ) -> CommandCacheKey {
319
+ pub fn cache_key ( & self ) -> CommandFingerprint {
320
320
let command = & self . command ;
321
- CommandCacheKey {
321
+ CommandFingerprint {
322
322
program : command. get_program ( ) . into ( ) ,
323
323
args : command. get_args ( ) . map ( OsStr :: to_os_string) . collect ( ) ,
324
324
envs : command
@@ -505,7 +505,7 @@ pub struct ExecutionContext {
505
505
506
506
#[ derive( Default ) ]
507
507
pub struct CommandCache {
508
- cache : Mutex < HashMap < CommandCacheKey , CommandOutput > > ,
508
+ cache : Mutex < HashMap < CommandFingerprint , CommandOutput > > ,
509
509
}
510
510
511
511
enum CommandState < ' a > {
@@ -516,7 +516,7 @@ enum CommandState<'a> {
516
516
stdout : OutputMode ,
517
517
stderr : OutputMode ,
518
518
executed_at : & ' a Location < ' a > ,
519
- cache_key : CommandCacheKey ,
519
+ cache_key : CommandFingerprint ,
520
520
start_time : Instant ,
521
521
} ,
522
522
}
@@ -533,11 +533,11 @@ pub struct DeferredCommand<'a> {
533
533
}
534
534
535
535
impl CommandCache {
536
- pub fn get ( & self , key : & CommandCacheKey ) -> Option < CommandOutput > {
536
+ pub fn get ( & self , key : & CommandFingerprint ) -> Option < CommandOutput > {
537
537
self . cache . lock ( ) . unwrap ( ) . get ( key) . cloned ( )
538
538
}
539
539
540
- pub fn insert ( & self , key : CommandCacheKey , output : CommandOutput ) {
540
+ pub fn insert ( & self , key : CommandFingerprint , output : CommandOutput ) {
541
541
self . cache . lock ( ) . unwrap ( ) . insert ( key, output) ;
542
542
}
543
543
}
0 commit comments