use serde::{Deserialize, Serialize};
use std::sync::{Arc, Mutex};
use std::time::SystemTime;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CachedRepository {
pub url: String,
pub branch: String,
pub local_cache_path: String,
pub last_pulled: SystemTime,
pub commit_hash: String,
#[serde(skip)]
pub in_use: Arc<Mutex<bool>>,
}
impl CachedRepository {
pub fn new(url: String, branch: String, local_cache_path: String, commit_hash: String) -> Self {
Self {
url,
branch,
local_cache_path,
last_pulled: SystemTime::now(),
commit_hash,
in_use: Arc::new(Mutex::new(false)),
}
}
}