pub enum CreditRegistrationState {
Show 16 variants
Pending,
ReadyToSubmit,
ResolvingEnrolment,
CheckingEnrolment,
NoUsableEnrolment,
Submitting,
SubmissionUncertain,
AwaitingVerification,
Registered,
Duplicate,
NotImproved,
Misregistered,
FailedRetryable,
FailedPermanent,
Blocked,
Cancelled,
}Expand description
What the pipeline does next with a ledger row.
Variants§
Pending
Waiting on a precondition: the completion or a linked student number. Which one is derived at read time, never stored.
ReadyToSubmit
ResolvingEnrolment
CheckingEnrolment
NoUsableEnrolment
Submitting
SubmissionUncertain
AwaitingVerification
Registered
Duplicate
NotImproved
Misregistered
FailedRetryable
FailedPermanent
Blocked
Cancelled
Implementations§
Source§impl CreditRegistrationState
impl CreditRegistrationState
Sourcepub const ALL: [Self; 16]
pub const ALL: [Self; 16]
Every state, so a classification can be proven exhaustive at runtime too.
Sourcepub const SUCCESS_STATES: [Self; 3]
pub const SUCCESS_STATES: [Self; 3]
Self::is_success’s states, for binding as = ANY($n::credit_registration_state[]) in
queries that would otherwise hand-retype the same set as a SQL literal. Order-independent;
kept in is_success’s own order for readability.
Sourcepub const OTHER_SUCCESS_STATES: [Self; 2]
pub const OTHER_SUCCESS_STATES: [Self; 2]
Self::SUCCESS_STATES minus Registered: the credit exists but we did not put it there.
Sourcepub const HARD_FAILURE_STATES: [Self; 2]
pub const HARD_FAILURE_STATES: [Self; 2]
The two states a “failed” count means across the admin reports: a permanent submit failure and a reversal the study registry made after the fact.
Sourcepub fn is_terminal(self) -> bool
pub fn is_terminal(self) -> bool
States the pipeline never leaves on its own. terminal_at tracks membership, cleared on
exit so an admin retry becomes visible to the stuck queries again.
Sourcepub fn is_failure(self) -> bool
pub fn is_failure(self) -> bool
Entry to one of these anchors the retry window in first_failed_at.
Sourcepub fn is_success(self) -> bool
pub fn is_success(self) -> bool
Used for reporting and for the double-registration guard.
Sourcepub fn allowed_targets(self) -> &'static [Self]
pub fn allowed_targets(self) -> &'static [Self]
The states the pipeline itself may move a row from self to, staying put excluded.
The one place the shape of the machine is written down: every edge here is one a phase, the
precondition recompute or the grade-improvement materialiser actually takes, and
transition refuses anything else. A hand transition also gets ADMIN_ONLY_TARGETS,
which is why they are not in here: an edge only a human may take must stay out of reach of a
phase that gets its target wrong.
Sourcepub fn resubmission_refusal(
self,
superseded: bool,
strictness: ResubmissionStrictness,
) -> Option<ResubmissionRefusal>
pub fn resubmission_refusal( self, superseded: bool, strictness: ResubmissionStrictness, ) -> Option<ResubmissionRefusal>
Whether a row in self may move back to ready_to_submit, and why not if it may not.
One precedence shared by the teacher-facing retry and the admin ledger’s hand transitions,
which otherwise refuse the same rows for the same reasons in three independently maintained
copies. strictness is the one real difference between the callers: how far outside a
failure a row may still be moved from. Superseded is checked first regardless, since acting
on a replaced attempt is never right, and an outcome the registry already holds next, since
no strictness may resubmit over one.
Sourcepub fn admin_transition_refusal(
self,
target: Self,
superseded: bool,
strictness: ResubmissionStrictness,
) -> Option<ResubmissionRefusal>
pub fn admin_transition_refusal( self, target: Self, superseded: bool, strictness: ResubmissionStrictness, ) -> Option<ResubmissionRefusal>
Why a hand transition of this row to target is refused, or None if it may go ahead.
The safety half of the admin path, next to the structural half in ADMIN_ONLY_TARGETS:
the edge table says the move exists, this says whether this row may take it. A row whose
outcome the study registry already holds is refused whatever the target, because cancelled
is a legal step on to ready_to_submit and would otherwise launder a second submission for
a credit Sisu has. strictness is how the caller treats submission_uncertain.
Sourcefn default_attempt_delay_secs(self) -> i64
fn default_attempt_delay_secs(self) -> i64
How long a row entering this state waits before the pipeline may claim it again, when the
caller of transition names no time of its own. Zero leaves it claimable at once.
Only the states a claim query reads, or a precondition arm holds a row in, need a nonzero
one: a phase that forgot to defer would otherwise spin on the row, since claim_due orders
by next_attempt_at. A caller with a real backoff to apply passes it and overrides this.
Trait Implementations§
Source§impl Clone for CreditRegistrationState
impl Clone for CreditRegistrationState
Source§fn clone(&self) -> CreditRegistrationState
fn clone(&self) -> CreditRegistrationState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ComposeSchema for CreditRegistrationState
impl ComposeSchema for CreditRegistrationState
Source§impl Debug for CreditRegistrationState
impl Debug for CreditRegistrationState
Source§impl<'r> Decode<'r, Postgres> for CreditRegistrationState
impl<'r> Decode<'r, Postgres> for CreditRegistrationState
Source§impl<'de> Deserialize<'de> for CreditRegistrationState
impl<'de> Deserialize<'de> for CreditRegistrationState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'q, DB: Database> Encode<'q, DB> for CreditRegistrationStatewhere
&'q str: Encode<'q, DB>,
impl<'q, DB: Database> Encode<'q, DB> for CreditRegistrationStatewhere
&'q str: Encode<'q, DB>,
Source§fn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer,
) -> Result<IsNull, BoxDynError>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer, ) -> Result<IsNull, BoxDynError>
fn size_hint(&self) -> usize
§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
Source§impl Hash for CreditRegistrationState
impl Hash for CreditRegistrationState
Source§impl PartialEq for CreditRegistrationState
impl PartialEq for CreditRegistrationState
Source§impl PgHasArrayType for CreditRegistrationState
impl PgHasArrayType for CreditRegistrationState
fn array_type_info() -> PgTypeInfo
fn array_compatible(ty: &PgTypeInfo) -> bool
Source§impl Serialize for CreditRegistrationState
impl Serialize for CreditRegistrationState
Source§impl ToSchema for CreditRegistrationState
impl ToSchema for CreditRegistrationState
Source§impl Type<Postgres> for CreditRegistrationState
impl Type<Postgres> for CreditRegistrationState
impl Copy for CreditRegistrationState
impl Eq for CreditRegistrationState
impl StructuralPartialEq for CreditRegistrationState
Auto Trait Implementations§
impl Freeze for CreditRegistrationState
impl RefUnwindSafe for CreditRegistrationState
impl Send for CreditRegistrationState
impl Sync for CreditRegistrationState
impl Unpin for CreditRegistrationState
impl UnsafeUnpin for CreditRegistrationState
impl UnwindSafe for CreditRegistrationState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].