Module delegation

Module delegation 

Source
Expand description

Delegation typestate for compile-time safety of delegation lifecycle.

Uses the typestate pattern to make invalid state transitions uncompilable.

§State Transition Diagram

create() → Pending ──┬── accept() ──→ Accepted ── start() → InProgress ──┬── complete() → Completed
                     ├── reject() ──→ Rejected (terminal)                └── fail() → Failed (terminal)
                     └── timeout() ─→ Failed (terminal)

Modules§

private 🔒

Structs§

Delegation
A delegation with compile-time state tracking.
DelegationAccepted
Delegation was accepted but not yet started.
DelegationCompleted
Delegation was completed successfully (terminal).
DelegationFailed
Delegation failed (terminal).
DelegationRecord
Internal data storage for a delegation, independent of typestate. This is what gets persisted to the database.
DelegationRejected
Delegation was rejected (terminal).
DelegationResult
Result of a completed delegation.
InProgress
Delegation work is in progress.
Pending
Delegation is pending acceptance.
StoredDelegation
A delegation as stored in the database (status-agnostic).

Enums§

DelegationResultStatus
Status of a delegation result.
DelegationStateError
Errors when transitioning delegation states.
DelegationStatus
Status of a delegation operation.
LoadedDelegation
Enum representing all possible runtime states of a delegation. Use this when you need to handle delegations loaded from the database.

Traits§

DelegationState
Marker trait for delegation states.