| 1 | # Dataspace Protocol TransferProcess state transitions |
| 2 | |
| 3 | ## Decision |
| 4 | |
| 5 | State machine for `TransferProcess` must be changed to align with the [Dataspace Protocol](https://docs.internationaldataspaces.org/communication-guide-v2-draft/overview/readme) |
| 6 | |
| 7 | ## Rationale |
| 8 | |
| 9 | The [new protocol state machine](https://docs.internationaldataspaces.org/communication-guide-v2-draft/transfer-process/transfer.process.protocol) |
| 10 | defines some simple and clear states that handles the lifecycle of a `TransferProcess`, |
| 11 | We need to adapt the EDC `TransferProcess` state machine to fit the provisioning/deprovisioning feature in it. |
| 12 | |
| 13 | ## Approach |
| 14 | |
| 15 | The "provisioning/deprovisioning" feature is not described in the protocol state machine because it is EDC custom, |
| 16 | to make it fit within the state machine we could see it as a wrapping state machine section: |
| 17 | |
| 18 | - Provisioning |
| 19 | - Protocol state machine |
| 20 | - Deprovisioning |
| 21 | |
| 22 | Doing this the states flow will change, because currently the deprovisioning phase happens before "ENDED/CANCELLED/ERROR", |
| 23 | that are the equivalent states of "COMPLETED/TERMINATED", but in fact the deprovisioning phase should happen after the |
| 24 | completion or termination. |
| 25 | |
| 26 | Another addition needed will be to add the `*ING` states missing: `STARTING`, `COMPLETING`, `TERMINATING`, needing for |
| 27 | reliability. |
| 28 | |
| 29 | The new states list should become like: |
| 30 | ``` |
| 31 | INITIAL(100), |
| 32 | // provisioning |
| 33 | PROVISIONING(200), |
| 34 | PROVISIONING_REQUESTED(250), |
| 35 | PROVISIONED(300), |
| 36 | // protocol state machine |
| 37 | REQUESTING(400), |
| 38 | REQUESTED(500), |
| 39 | STARTING(550), |
| 40 | STARTED(600), |
| 41 | SUSPENDING(650), |
| 42 | SUSPENDED(700), |
| 43 | COMPLETING(750), |
| 44 | COMPLETED(800), |
| 45 | TERMINATING(825), |
| 46 | TERMINATED(850), |
| 47 | // deprovisioning |
| 48 | DEPROVISIONING(900), |
| 49 | DEPROVISIONING_REQUESTED(950), |
| 50 | DEPROVISIONED(1000), |
| 51 | // old states to be deleted |
| 52 | @Deprecated(since = "milestone9") ERROR(-1), |
| 53 | @Deprecated(since = "milestone9") UNSAVED(0), |
| 54 | @Deprecated(since = "milestone9") IN_PROGRESS(600), |
| 55 | @Deprecated(since = "milestone9") STREAMING(700), |
| 56 | @Deprecated(since = "milestone9") ENDED(1100), |
| 57 | @Deprecated(since = "milestone9") CANCELLED(1200); |
| 58 | ``` |