aboutsummaryrefslogtreecommitdiff
path: root/src/repo/mod.rs
diff options
context:
space:
mode:
authorMax Audron <audron@cocaine.farm>2022-06-07 12:28:18 +0200
committerMaximilian Manz <maximilian.manz@de.clara.net>2022-06-20 11:33:04 +0200
commit012bf0593df7bf93afb73db5c87dd8ccc36e851f (patch)
tree7606ed25710a058012e8ffb8bda736bbfd6a1a3f /src/repo/mod.rs
parentreorganize file structure and cleanup lints (diff)
move to mostly sync architecture
the git repository struct is not sharable between threads, thus go single threaded for now and only call onto the tokio runtime for lookups towards gitlab.
Diffstat (limited to 'src/repo/mod.rs')
-rw-r--r--src/repo/mod.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/repo/mod.rs b/src/repo/mod.rs
index e3d1279..aaf0177 100644
--- a/src/repo/mod.rs
+++ b/src/repo/mod.rs
@@ -1,4 +1,9 @@
-use std::{fmt::Debug, path::PathBuf};
+use std::{
+ collections::HashMap,
+ fmt::Debug,
+ path::PathBuf,
+ sync::RwLock,
+};
use thiserror::Error;
@@ -13,7 +18,8 @@ mod repostate;
pub use aggregate::*;
pub use repostate::*;
-pub type Repos = Vec<Repo>;
+// pub type Repos = Vec<Repo>;
+pub type Repos = HashMap<String, RwLock<Repo>>;
pub struct Repo {
pub name: String,
@@ -83,9 +89,7 @@ impl Repo {
let mut builder = git2::build::RepoBuilder::new();
builder.fetch_options(crate::git::fetch_options());
- builder
- .clone(url, &self.path)
- .map_err(RepoError::GitError)
+ builder.clone(url, &self.path).map_err(RepoError::GitError)
}
#[tracing::instrument(level = "trace")]