gitai/remote/models/
cached_repo.rs1use serde::{Deserialize, Serialize};
2use std::sync::{Arc, Mutex};
3use std::time::SystemTime;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct CachedRepository {
7 pub url: String,
9 pub branch: String,
11 pub local_cache_path: String,
13 pub last_pulled: SystemTime,
15 pub commit_hash: String,
17 #[serde(skip)]
20 pub in_use: Arc<Mutex<bool>>,
21}
22
23impl CachedRepository {
24 pub fn new(url: String, branch: String, local_cache_path: String, commit_hash: String) -> Self {
25 Self {
26 url,
27 branch,
28 local_cache_path,
29 last_pulled: SystemTime::now(),
30 commit_hash,
31 in_use: Arc::new(Mutex::new(false)),
32 }
33 }
34}