summaryrefslogtreecommitdiffstats
path: root/src/db/model.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/model.rs')
-rw-r--r--src/db/model.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/db/model.rs b/src/db/model.rs
index e962d6f..dfc1f8b 100644
--- a/src/db/model.rs
+++ b/src/db/model.rs
@@ -21,6 +21,29 @@ pub struct UpstreamPin {
pub commit: String,
}
+/// A row of the Stage B cache (§5.2): the version that resolution produced,
+/// with the pins it was computed from.
+///
+/// This lives with the schema because the table lives here — the persistence
+/// layer must not name a type from the module that owns VCS probing, which is
+/// the dependency pointing the wrong way (§6 M-6). `watch::upstream::StageB`
+/// is this plus `cached`, and that extra field is the reason the two are not
+/// the same type: "was this answer a cache hit?" is a fact about the resolution
+/// that just happened, not a column.
+#[derive(Debug, Clone)]
+pub struct StageBCacheRow {
+ pub epoch: String,
+ pub pkgver: String,
+ pub pkgrel: String,
+ pub pins: Vec<UpstreamPin>,
+}
+
+impl StageBCacheRow {
+ pub fn version(&self) -> String {
+ crate::pkgver::full_version(&self.epoch, &self.pkgver, &self.pkgrel)
+ }
+}
+
/// A source entry with the digest *we* computed, regardless of what the
/// PKGBUILD declares (§5.3).
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]