summaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/db')
-rw-r--r--src/db/mod.rs4
-rw-r--r--src/db/pkgbases.rs10
2 files changed, 13 insertions, 1 deletions
diff --git a/src/db/mod.rs b/src/db/mod.rs
index e42bae4..992a2b6 100644
--- a/src/db/mod.rs
+++ b/src/db/mod.rs
@@ -52,8 +52,10 @@ pub use packages::{
index_version, our_package_names,
};
pub use pkgbases::{
- Pkgbase, accepted_release_for, cas_accepted_release, get_pkgbase, get_pkgbase_by_id, set_aur_head,
+ Pkgbase, accepted_release_for, get_pkgbase, get_pkgbase_by_id, set_aur_head,
};
+#[cfg(feature = "test-support")]
+pub use pkgbases::cas_accepted_release;
pub use publish_writes::{
NewRelease, accepted_pointer_in, artifact_path, cas_accepted_release_in,
insert_package_in, insert_release_in, remove_index_packages_in, remove_package_by_name_in,
diff --git a/src/db/pkgbases.rs b/src/db/pkgbases.rs
index 8373024..0f711a7 100644
--- a/src/db/pkgbases.rs
+++ b/src/db/pkgbases.rs
@@ -81,6 +81,16 @@ 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.
+#[cfg(feature = "test-support")]
pub fn cas_accepted_release(
writer: &Writer,
pkgbase_id: i64,