diff options
Diffstat (limited to 'src/db/mod.rs')
| -rw-r--r-- | src/db/mod.rs | 72 |
1 files changed, 69 insertions, 3 deletions
diff --git a/src/db/mod.rs b/src/db/mod.rs index 95833be..d4befcc 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -3,10 +3,77 @@ pub mod builds; pub mod candidates; pub mod migrations; pub mod model; -pub mod queries; + +// 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. +mod audit; +mod invariants; +mod metrics; +mod notices; +mod packages; +mod pkgbases; +mod publish_writes; +mod releases; +mod repos; +mod retention; +mod settings; +mod snapshots; +mod stage_b; +mod staleness; +mod subscriptions; +mod world; pub use migrations::MIGRATIONS; -pub use model::*; + +pub use model::{ + BUILD_STEPS, BuildState, CandidateRow, CandidateState, Identity, Recipe, ReleaseRow, + ReleaseState, SourceDigest, SourceEntry, StageBCacheRow, StateEnum, StepState, + SubscriptionState, UpstreamPin, WorldMember, candidate_kind, json_or, notice_kind, +}; +pub use audit::{AuditEntry, AuditRow, audit, audit_in, audit_system, list_audit}; +pub use invariants::{Unbuilt, approved_but_unbuilt, index_pkgbase_drift, unapproved_index_entries}; +pub use metrics::{ + artifact_bytes_served, build_state_counts, count_index_packages, count_pending_reviews, + count_published_releases, count_subscriptions, count_unacknowledged_notices, + last_gc_age_secs, last_poll_age_secs, oldest_queued_age_secs, pending_review_ages_secs, +}; +pub use notices::{NoticeRow, acknowledge_notice, list_notices, put_notice, put_notice_once}; +pub use packages::{ + PackageRow, accepted_recipe, builds_for_pkgbase, index_artifact, index_packages, + index_version, is_ours, our_package_names, +}; +pub use pkgbases::{ + Pkgbase, cas_accepted_release, get_pkgbase, get_pkgbase_by_id, list_pkgbases, set_aur_head, + set_unpinable, +}; +pub use publish_writes::{ + NewRelease, accepted_pointer_in, artifact_id_by_digest_in, artifact_path, + cas_accepted_release_in, insert_package_in, insert_release_in, remove_index_packages_in, + remove_package_by_name_in, +}; +pub use releases::{ + accepted_release, all_published_releases, release_by_id, releases_for_pkgbase, + withdraw_release_in, +}; +pub use repos::{ensure_repo, repo_id}; +pub use retention::{ + ArtifactPaths, mark_release_purged, pkgbase_release_pointers, published_release_ids, + record_gc_run, release_artifact_paths, serving_release_ids, +}; +pub use settings::{all_settings, set_setting, setting, setting_i64}; +pub use snapshots::{SnapshotRow, put_snapshot, snapshot_by_commit, snapshot_by_id}; +pub use stage_b::{stage_b_cache_get, stage_b_cache_put, stage_b_recent}; +pub use staleness::{ + NewArtifact, approval_note, candidate_snapshot_id, index_recipes, insert_artifact_in, + published_world_members, put_source_cache, served_vs_offered_pkgvers, source_cache_path, + subscription_poll_interval, +}; +pub use subscriptions::{ + Subscription, due_subscriptions, get_subscription, list_subscriptions, note_check, + set_subscription_state, subscribe, +}; +pub use world::{put_world_snapshot, world_members}; pub(crate) fn state_col<T: StateEnum>(col: usize, text: &str) -> rusqlite::Result<T> { T::parse(text).ok_or_else(|| { @@ -21,7 +88,6 @@ pub(crate) fn state_col<T: StateEnum>(col: usize, text: &str) -> rusqlite::Resul }) } -pub use queries::*; use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicBool, Ordering}; |
