1- use std:: { path:: PathBuf , rc :: Rc } ;
1+ use std:: { path:: PathBuf , sync :: Arc } ;
22
33use log:: info;
44
@@ -78,7 +78,7 @@ pub fn cache_root_init(path: Option<PathBuf>) -> Result<(), ExecutorError> {
7878#[ derive( Debug , Clone ) ]
7979pub struct CacheDir {
8080 #[ allow( dead_code) ]
81- entity : Rc < SchedEntity > ,
81+ entity : Arc < SchedEntity > ,
8282 pub path : PathBuf ,
8383 pub cache_type : CacheDirType ,
8484}
@@ -92,9 +92,9 @@ pub enum CacheDirType {
9292impl CacheDir {
9393 pub const DADK_BUILD_CACHE_DIR_ENV_KEY_PREFIX : & ' static str = "DADK_BUILD_CACHE_DIR" ;
9494 pub const DADK_SOURCE_CACHE_DIR_ENV_KEY_PREFIX : & ' static str = "DADK_SOURCE_CACHE_DIR" ;
95- pub fn new ( entity : Rc < SchedEntity > , cache_type : CacheDirType ) -> Result < Self , ExecutorError > {
95+ pub fn new ( entity : Arc < SchedEntity > , cache_type : CacheDirType ) -> Result < Self , ExecutorError > {
9696 let task = entity. task ( ) ;
97- let path = Self :: get_path ( task, cache_type) ;
97+ let path = Self :: get_path ( & task, cache_type) ;
9898
9999 let result = Self {
100100 entity,
@@ -122,15 +122,15 @@ impl CacheDir {
122122 return PathBuf :: from ( cache_dir) ;
123123 }
124124
125- pub fn build_dir ( entity : Rc < SchedEntity > ) -> Result < PathBuf , ExecutorError > {
126- return Ok ( Self :: new ( entity, CacheDirType :: Build ) ?. path ) ;
125+ pub fn build_dir ( entity : Arc < SchedEntity > ) -> Result < PathBuf , ExecutorError > {
126+ return Ok ( Self :: new ( entity. clone ( ) , CacheDirType :: Build ) ?. path ) ;
127127 }
128128
129- pub fn source_dir ( entity : Rc < SchedEntity > ) -> Result < PathBuf , ExecutorError > {
130- return Ok ( Self :: new ( entity, CacheDirType :: Source ) ?. path ) ;
129+ pub fn source_dir ( entity : Arc < SchedEntity > ) -> Result < PathBuf , ExecutorError > {
130+ return Ok ( Self :: new ( entity. clone ( ) , CacheDirType :: Source ) ?. path ) ;
131131 }
132132
133- pub fn build_dir_env_key ( entity : & Rc < SchedEntity > ) -> Result < String , ExecutorError > {
133+ pub fn build_dir_env_key ( entity : & Arc < SchedEntity > ) -> Result < String , ExecutorError > {
134134 let name_version_env = entity. task ( ) . name_version_env ( ) ;
135135 return Ok ( format ! (
136136 "{}_{}" ,
@@ -139,7 +139,7 @@ impl CacheDir {
139139 ) ) ;
140140 }
141141
142- pub fn source_dir_env_key ( entity : & Rc < SchedEntity > ) -> Result < String , ExecutorError > {
142+ pub fn source_dir_env_key ( entity : & Arc < SchedEntity > ) -> Result < String , ExecutorError > {
143143 let name_version_env = entity. task ( ) . name_version_env ( ) ;
144144 return Ok ( format ! (
145145 "{}_{}" ,
@@ -148,7 +148,7 @@ impl CacheDir {
148148 ) ) ;
149149 }
150150
151- pub fn need_source_cache ( entity : & Rc < SchedEntity > ) -> bool {
151+ pub fn need_source_cache ( entity : & Arc < SchedEntity > ) -> bool {
152152 let task_type = & entity. task ( ) . task_type ;
153153
154154 if let TaskType :: BuildFromSource ( cs) = task_type {
0 commit comments