aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTeddy Wing2021-06-06 19:10:04 +0200
committerTeddy Wing2021-06-06 19:10:04 +0200
commit3ec4dcd1e21201a279552a549ba979ee13c07e77 (patch)
tree9ad89d7ecd6e628f9a75a537f8b835a7f412a2f7 /src
parentdfc96955a7868d2ade02a2ac2228199d49c68399 (diff)
downloadreflectub-3ec4dcd1e21201a279552a549ba979ee13c07e77.tar.bz2
main: Add function documentation
Diffstat (limited to 'src')
-rw-r--r--src/main.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 6cc5cfb..815d21c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -145,6 +145,7 @@ fn run() -> anyhow::Result<()> {
Ok(())
}
+/// Mirror or update `repo`.
async fn process_repo(
repo: &github::Repo,
db: &mut database::Db,
@@ -192,6 +193,7 @@ async fn process_repo(
}
+/// Return `true` if `size_kilobytes` is larger than `max_repo_size_bytes`.
fn is_repo_oversize(
size_kilobytes: u64,
max_repo_size_bytes: u64,
@@ -205,6 +207,9 @@ fn is_repo_oversize(
false
}
+/// Get the clone path for a repository.
+///
+/// If `repo` is a fork, add `/fork/` to `base_path`.
fn clone_path<P: AsRef<Path>>(base_path: P, repo: &github::Repo) -> PathBuf {
let git_dir = format!("{}.git", repo.name);
@@ -220,6 +225,7 @@ fn clone_path<P: AsRef<Path>>(base_path: P, repo: &github::Repo) -> PathBuf {
}
}
+/// Mirror a repository.
fn mirror<P: AsRef<Path>>(
clone_path: P,
repo: &github::Repo,
@@ -248,6 +254,7 @@ fn mirror<P: AsRef<Path>>(
Ok(())
}
+/// Update a previously-mirrored repository.
fn update<P: AsRef<Path>>(
repo_path: P,
current_repo: &database::Repo,