summaryrefslogtreecommitdiffstats
path: root/src/usecase/bootstrap.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-23 13:44:20 +0000
committeraur-build <aur-build@localhost>2026-11-23 13:44:20 +0000
commit4c143e969dcd7b6a18e5a86f9a754c9b62979ccf (patch)
treec61c2274e3810669cef8319cf9980cbbe031f840 /src/usecase/bootstrap.rs
parent053dfbca8a4955a616e9b2c0f5a5d664c0db7aef (diff)
downloadaur-build-4c143e969dcd7b6a18e5a86f9a754c9b62979ccf.tar.gz
aur-build-4c143e969dcd7b6a18e5a86f9a754c9b62979ccf.zip
usecase,http,pipeline,ops: keep the contract, drop the argument
A workflow's doc now says what it guarantees and stops defending its existence: `subscribe` resolves the repo row, `approve` queues what the approval buys, a per-item failure comes back as a value instead of a panic. The history of which front end used to open-code it is gone. The last census-war notes go with it — three places that explained why a name in a test string was not a caller.
Diffstat (limited to 'src/usecase/bootstrap.rs')
-rw-r--r--src/usecase/bootstrap.rs19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/usecase/bootstrap.rs b/src/usecase/bootstrap.rs
index 6793076..a4e64d2 100644
--- a/src/usecase/bootstrap.rs
+++ b/src/usecase/bootstrap.rs
@@ -1,5 +1,4 @@
-//! Bringing a repository up, which every command does and every front end
-//! used to write out for itself.
+//! Bringing a repository up, which every command does.
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
@@ -10,17 +9,13 @@ use crate::error::Result;
use crate::pipeline;
/// Directories exist, the schema is current, and the repo row is present.
-///
-/// Four calls in an order that matters — migrate before open, `ensure_repo`
-/// before anything reads `repo_id` — which is precisely the kind of sequence
-/// that quietly rots when it is copied.
+/// Order matters: migrate before open, `ensure_repo` before anything reads
+/// `repo_id`.
pub fn open(cfg: &Config) -> Result<Db> {
open_and_ensure(cfg).map(|(db, _)| db)
}
-/// `open`, plus the id of the row named by `cfg.repo_name` — which is what
-/// `init` prints, and is not necessarily the lowest repo id if a root ever
-/// holds more than one repo.
+/// `open`, plus the id of the row named by `cfg.repo_name`.
fn open_and_ensure(cfg: &Config) -> Result<(Db, i64)> {
cfg.ensure_dirs()?;
db::migrate(&cfg.db_path())?;
@@ -44,10 +39,8 @@ pub fn init(cfg: &Config) -> Result<i64> {
/// Everything `serve` does before control passes to the UI: bring the
/// repository up, finish anything a previous run left half-published, and start
-/// the two background loops.
-///
-/// The HTTP server is deliberately not started here. This module sits below the
-/// UI and must not be able to name it.
+/// the two background loops. This module sits below the UI, so it cannot start
+/// the HTTP server.
pub fn serve(cfg: &Config) -> Result<Db> {
let db = open(cfg)?;
let _ = pipeline::publish::reconcile(cfg, &db);