summaryrefslogtreecommitdiffstats
path: root/src/db/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/model')
-rw-r--r--src/db/model/build_state.rs4
-rw-r--r--src/db/model/state.rs28
2 files changed, 2 insertions, 30 deletions
diff --git a/src/db/model/build_state.rs b/src/db/model/build_state.rs
index d081bca..37eee79 100644
--- a/src/db/model/build_state.rs
+++ b/src/db/model/build_state.rs
@@ -66,7 +66,7 @@ impl BuildState {
}
}
- pub fn predecessors(to: BuildState) -> Vec<&'static str> {
+ pub(crate) fn predecessors(to: BuildState) -> Vec<&'static str> {
BuildState::ALL
.iter()
.filter(|from| from.can_transition(to))
@@ -143,7 +143,7 @@ impl StepState {
}
}
- pub fn predecessors(to: StepState) -> Vec<&'static str> {
+ pub(crate) fn predecessors(to: StepState) -> Vec<&'static str> {
StepState::ALL
.iter()
.filter(|from| from.can_transition(to))
diff --git a/src/db/model/state.rs b/src/db/model/state.rs
index dcc9b84..18860ff 100644
--- a/src/db/model/state.rs
+++ b/src/db/model/state.rs
@@ -118,20 +118,6 @@ impl ReleaseState {
pub fn parse(s: &str) -> Option<ReleaseState> {
ReleaseState::ALL.iter().copied().find(|r| r.as_str() == s)
}
-
- /// NOTE: nothing consults this table today — release transitions are
- /// enforced elsewhere. Left `pub` and dead rather than quietly deleted
- /// or quietly wired up; it is a disposition-table decision.
- pub fn can_transition(&self, to: ReleaseState) -> bool {
- use ReleaseState::*;
- if *self == to {
- return true;
- }
- match self {
- Published => matches!(to, Withdrawn | FailedUnbuilt),
- Withdrawn | FailedUnbuilt => false,
- }
- }
}
impl std::fmt::Display for ReleaseState {
@@ -199,20 +185,6 @@ impl SubscriptionState {
pub fn parse(text: &str) -> Option<SubscriptionState> {
SubscriptionState::ALL.iter().copied().find(|st| st.as_str() == text)
}
-
- /// NOTE: dead in the same way as `ReleaseState::can_transition`.
- pub fn can_transition(&self, to: SubscriptionState) -> bool {
- use SubscriptionState::*;
- if *self == to {
- return true;
- }
- match self {
- Active => matches!(to, Paused | Orphaned | Removed),
- Paused => matches!(to, Active | Orphaned | Removed),
- Orphaned => matches!(to, Active | Removed),
- Removed => false,
- }
- }
}
impl std::fmt::Display for SubscriptionState {