summaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/db')
-rw-r--r--src/db/builds/mod.rs11
-rw-r--r--src/db/invariants.rs10
-rw-r--r--src/db/migrations.rs1
-rw-r--r--src/db/mod.rs18
-rw-r--r--src/db/model/state.rs16
-rw-r--r--src/db/packages.rs1
-rw-r--r--src/db/pkgbases.rs16
-rw-r--r--src/db/subscriptions.rs1
8 files changed, 15 insertions, 59 deletions
diff --git a/src/db/builds/mod.rs b/src/db/builds/mod.rs
index e31543e..50aee63 100644
--- a/src/db/builds/mod.rs
+++ b/src/db/builds/mod.rs
@@ -119,13 +119,8 @@ pub fn queued(db: &Db, limit: i64) -> Result<Vec<String>> {
})
}
-/// Lease one named build to a worker.
-///
-/// Test-tier only. Production leases a *batch* — `claim_batch` is what the
-/// dispatcher runs — and nothing in the crate calls this single-build form.
-/// It stays because three test files lease one build at a time on purpose,
-/// and a test that wants to reason about one lease should not have to
-/// arrange for the batch form to hand back exactly one.
+/// Lease one named build to a worker. Production leases batches through
+/// `claim_batch`.
#[cfg(feature = "test-support")]
pub fn claim(db: &Db, owner: &str, id: &str, lease_secs: i64) -> Result<bool> {
let (owner, id) = (owner.to_string(), id.to_string());
@@ -267,8 +262,6 @@ pub fn cancel_requested(db: &Db, id: &str) -> Result<bool> {
})
}
-// The step machine is its own concern: same build, one row per step, its own
-// legal moves.
mod steps;
pub use steps::{
diff --git a/src/db/invariants.rs b/src/db/invariants.rs
index e2e6b13..d768c76 100644
--- a/src/db/invariants.rs
+++ b/src/db/invariants.rs
@@ -1,13 +1,8 @@
use crate::db::Db;
use crate::error::Result;
-/// Repo entries whose candidate was never approved.
-///
-/// Test-tier only, and deliberately so: this is an invariant the schema does
-/// not enforce and production does not check, so the only thing that keeps it
-/// true is that a test asserts it on every run. It is gated rather than moved
-/// to `tests/common` because reading it needs this module's private helpers,
-/// and widening those to let a test out would be the wrong trade.
+/// Repo entries whose candidate was never approved — an invariant only a test
+/// keeps true, so nothing in production asks for it.
#[cfg(feature = "test-support")]
pub fn unapproved_index_entries(db: &Db) -> Result<Vec<String>> {
db.read(|c| {
@@ -27,7 +22,6 @@ pub fn unapproved_index_entries(db: &Db) -> Result<Vec<String>> {
}
#[derive(Debug, Clone)]
-// Unbuilt stays `pub`: the attention row `approved_but_unbuilt` returns to the web UI and to tests/crash.rs.
pub struct Unbuilt {
pub pkgbase: String,
pub approved: String,
diff --git a/src/db/migrations.rs b/src/db/migrations.rs
index 2e552f2..c41adc6 100644
--- a/src/db/migrations.rs
+++ b/src/db/migrations.rs
@@ -1,4 +1,3 @@
-// Migration stays `pub`: the row type of `MIGRATIONS`, which is `pub` only under `test-support`; production walks the table through `db::migrate` without naming it.
pub struct Migration {
pub version: u32,
pub name: &'static str,
diff --git a/src/db/mod.rs b/src/db/mod.rs
index 27d1bfb..6f15c88 100644
--- a/src/db/mod.rs
+++ b/src/db/mod.rs
@@ -4,9 +4,7 @@ pub mod candidates;
pub mod migrations;
pub mod model;
-// The queries this module owns, one module per aggregate. They are private:
-// the interface is what `pub use` names below, not the file layout, so a
-// caller cannot reach a query that was not chosen for export.
+// One private module per aggregate; the interface is the `pub use` below.
mod audit;
mod invariants;
mod metrics;
@@ -24,9 +22,7 @@ mod staleness;
mod subscriptions;
mod world;
-/// The alias is only ever used from outside `db`, and only by the test tier;
-/// `db::migrate` walks `migrations::MIGRATIONS` by its own path, so there is
-/// no crate-internal alias to keep in a production build.
+/// Aliased only for the test tier; `db::migrate` walks `MIGRATIONS` by its own path.
#[cfg(feature = "test-support")]
pub use migrations::MIGRATIONS;
/// Its only caller is the test-tier `world_members`, so it is gated with it.
@@ -43,8 +39,7 @@ pub use metrics::{
count_subscriptions, count_unacknowledged_notices, last_gc_age_secs, last_poll_age_secs, oldest_queued_age_secs,
pending_review_ages_secs,
};
-/// `ReleaseState` is a column type on the release row. Nothing outside `db`
-/// names it, so the alias out of `db` exists only for the test tier.
+/// A column type on the release row; nothing outside `db` names it.
#[cfg(feature = "test-support")]
pub use model::ReleaseState;
#[cfg(not(feature = "test-support"))]
@@ -249,11 +244,8 @@ impl Writer {
self.tx.send(Msg::Call(f)).map_err(|_| Error::db("writer actor gone"))
}
- /// Stop the writer actor.
- ///
- /// Test-tier only: the server runs until the process ends and never
- /// quiesces the writer deliberately. Tests use it to prove a worker
- /// that dies mid-write leaves the database consistent.
+ /// Stop the writer actor. The server never quiesces it; tests use this to
+ /// prove a worker that dies mid-write leaves the database consistent.
#[cfg(feature = "test-support")]
pub fn shutdown(&self) {
let _ = self.tx.send(Msg::Shutdown);
diff --git a/src/db/model/state.rs b/src/db/model/state.rs
index 4057652..0eb9b6e 100644
--- a/src/db/model/state.rs
+++ b/src/db/model/state.rs
@@ -68,10 +68,7 @@ pub mod candidate_kind {
pub const FIRST_INTRODUCTION: &str = "first_introduction";
}
-/// The real definition. The module is private, so this `pub`
-/// is not a nameable path from outside; the alias below is the
-/// only way to reach it, and the alias is what carries the
-/// feature-conditional visibility.
+/// The real definition; the alias below carries the visibility.
mod release_state {
use super::{Deserialize, Serialize};
@@ -84,11 +81,7 @@ mod release_state {
}
}
-/// The state column of a release row. `ReleaseRow` is public and its `state` field is typed here, so the type stays reachable in a release build only through this alias.
-///
-/// `pub` only under `test-support`. Production reaches the type
-/// through its own module and never names it from outside; the
-/// outside reader that needs the name is a test.
+/// The state column of a release row.
#[cfg(feature = "test-support")]
pub use release_state::ReleaseState;
@@ -189,10 +182,7 @@ impl std::fmt::Display for SubscriptionState {
mod tests {
use super::*;
- // The three enums declared here keep their `ALL` private, so the round trip
- // through column text — the property that makes a stored row readable back
- // — is checked here rather than from outside. BuildState and StepState are
- // covered in build_state.rs.
+ // `ALL` is private, so the round trip through column text is checked here.
#[test]
fn every_state_declared_here_round_trips_through_its_column_text() {
diff --git a/src/db/packages.rs b/src/db/packages.rs
index 8612b35..14ab270 100644
--- a/src/db/packages.rs
+++ b/src/db/packages.rs
@@ -4,7 +4,6 @@ use crate::db::{Db, Recipe, ReleaseRow};
use crate::error::Result;
#[derive(Debug, Clone)]
-// PackageRow stays `pub`: what `index_packages` hands back to `http`, the publish step and the `aur-build` binary, which bind it without naming it.
pub struct PackageRow {
pub id: i64,
pub release_id: i64,
diff --git a/src/db/pkgbases.rs b/src/db/pkgbases.rs
index 1513928..ba52472 100644
--- a/src/db/pkgbases.rs
+++ b/src/db/pkgbases.rs
@@ -45,10 +45,7 @@ pub fn get_pkgbase_by_id(db: &Db, id: i64) -> Result<Option<Pkgbase>> {
})
}
-/// The release a pkgbase currently points at, if it points at one. This is a
-/// pointer stored on the pkgbase row, so reading it is a persistence question,
-/// not a review one — the watcher needs it to decide what a change is a change
-/// *from*, and review must not be the only way to ask.
+/// The release a pkgbase currently points at, if it points at one.
pub fn accepted_release_for(db: &Db, pb: &Pkgbase) -> Result<Option<ReleaseRow>> {
match pb.current_accepted_release_id {
Some(id) => release_by_id(db, id),
@@ -64,15 +61,8 @@ pub fn set_aur_head(writer: &Writer, pkgbase_id: i64, head: &str, mirror: &str)
})
}
-/// Compare-and-set the accepted-release pointer.
-///
-/// Test-tier only, and the reason is worth keeping next to it: production
-/// performs this CAS inside a transaction through `cas_accepted_release_in`,
-/// which is what `pipeline::publish` calls at publish.rs:208. This standalone
-/// form takes a `Writer` and is called by nothing in the crate — `tests/db.rs`
-/// alone pins that the pointer moves once and refuses the second time. The two
-/// names differ by three characters, which is exactly how a name-match census
-/// once credited this function with a production caller it never had.
+/// Compare-and-set the accepted-release pointer. Production does its CAS inside
+/// a transaction through `cas_accepted_release_in`.
#[cfg(feature = "test-support")]
pub fn cas_accepted_release(writer: &Writer, pkgbase_id: i64, expected: Option<i64>, new_id: i64) -> Result<bool> {
writer.tx(move |tx| {
diff --git a/src/db/subscriptions.rs b/src/db/subscriptions.rs
index 903e1de..a95e51b 100644
--- a/src/db/subscriptions.rs
+++ b/src/db/subscriptions.rs
@@ -5,7 +5,6 @@ use crate::error::Result;
use crate::time;
#[derive(Debug, Clone)]
-// Subscription stays `pub`: what `get_subscription` and `list_subscriptions` hand back to `watch`, `usecase`, the binary and tests/detect.rs.
pub struct Subscription {
pub id: i64,
pub pkgbase: String,