Skip to main content

CreditRegistrationState

Enum CreditRegistrationState 

Source
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

Source

pub const ALL: [Self; 16]

Every state, so a classification can be proven exhaustive at runtime too.

Source

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.

Source

pub const OTHER_SUCCESS_STATES: [Self; 2]

Self::SUCCESS_STATES minus Registered: the credit exists but we did not put it there.

Source

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.

Source

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.

Source

pub fn is_failure(self) -> bool

Entry to one of these anchors the retry window in first_failed_at.

Source

pub fn is_success(self) -> bool

Used for reporting and for the double-registration guard.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> CreditRegistrationState

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ComposeSchema for CreditRegistrationState

Source§

fn compose(generics: Vec<RefOr<Schema>>) -> RefOr<Schema>

Source§

impl Debug for CreditRegistrationState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'r> Decode<'r, Postgres> for CreditRegistrationState

Source§

fn decode( value: PgValueRef<'r>, ) -> Result<Self, Box<dyn Error + Send + Sync + 'static>>

Decode a new value of this type using a raw value from the database.
Source§

impl<'de> Deserialize<'de> for CreditRegistrationState

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'q, DB: Database> Encode<'q, DB> for CreditRegistrationState
where &'q str: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer, ) -> Result<IsNull, BoxDynError>

Writes the value of self into buf without moving self. Read more
Source§

fn size_hint(&self) -> usize

§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Sync + Send>>
where Self: Sized,

Writes the value of self into buf in the expected format for the database.
§

fn produces(&self) -> Option<<DB as Database>::TypeInfo>

Source§

impl Hash for CreditRegistrationState

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CreditRegistrationState

Source§

fn eq(&self, other: &CreditRegistrationState) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PgHasArrayType for CreditRegistrationState

Source§

fn array_type_info() -> PgTypeInfo

§

fn array_compatible(ty: &PgTypeInfo) -> bool

Source§

impl Serialize for CreditRegistrationState

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ToSchema for CreditRegistrationState

Source§

fn name() -> Cow<'static, str>

Return name of the schema. Read more
Source§

fn schemas(schemas: &mut Vec<(String, RefOr<Schema>)>)

Implement reference [utoipa::openapi::schema::Schema]s for this type. Read more
Source§

impl Type<Postgres> for CreditRegistrationState

Source§

fn type_info() -> PgTypeInfo

Returns the canonical SQL type for this Rust type. Read more
§

fn compatible(ty: &<DB as Database>::TypeInfo) -> bool

Determines if this Rust type is compatible with the given SQL type. Read more
Source§

impl Copy for CreditRegistrationState

Source§

impl Eq for CreditRegistrationState

Source§

impl StructuralPartialEq for CreditRegistrationState

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> PartialSchema for T
where T: ComposeSchema + ?Sized,

§

fn schema() -> RefOr<Schema>

Return ref or schema of implementing type that can then be used to construct combined schemas.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ServiceExt for T

§

fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>
where Self: Sized,

Apply a transformation to the response body. Read more
§

fn decompression(self) -> Decompression<Self>
where Self: Sized,

Decompress response bodies. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,