add timeout sequence diagram

This commit is contained in:
Rémi Heredero 2023-10-21 18:29:00 +02:00
parent 68fd8440fc
commit c07c47385e
3 changed files with 71 additions and 0 deletions

BIN
UML/timeout.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

62
UML/timeout.puml Normal file
View File

@ -0,0 +1,62 @@
@startuml
participant "Behavior::StateMachine" as sm
participant Dispatcher as d
participant TimeoutManager as tm
entity "Event::Timeout" as t
queue "TimeoutManager::timeouts_" as timeouts
autoactivate off
|||
|||
== Schedule timeout ==
|||
sm -> sm++ : scheduleTimeout
sm -> d ++: getDispatcher
d --> sm --: dispatcher
sm -> d --++ : scheduleTimeout
d -> tm ++: getTimeoutManager
tm --> d --: timeoutManager
d -> tm --++ : scheduleTimeout
tm -> t ** : new
t --> tm
tm -> timeouts --++: insert
|||
|||
== Decrement timeout (and dispatch) ==
|||
loop every tickInterval
?->> tm ++: tick
tm -> timeouts : getFront
timeouts -> t ++
t --> timeouts
timeouts --> tm : timeout
tm -> t --: decrement
end
|||
note left t
When timeout is 0,
dispatch event
end note
t -> timeouts : pop
deactivate timeouts
t ->? --: pushEvent
|||
|||
== Unschedule timeout ==
|||
sm -> sm++ : unscheduleTimeout
sm -> d ++: getDispatcher
d --> sm --: dispatcher
sm -> d --++ : unscheduleTimeout
d -> tm ++: getTimeoutManager
tm --> d --: timeoutManager
d -> tm --++ : unscheduleTimeout
tm -> timeouts --: erase
timeouts -> t !!
@enduml

View File

@ -8,6 +8,9 @@
# Time Algorithm # Time Algorithm
<details>
<summary>Code puml (maybe it's displayed) </summary>
```plantuml ```plantuml
@startuml @startuml
@ -37,9 +40,15 @@ endif
@enduml @enduml
``` ```
</details>
<img src="./UML/timeAlgorithme.png"> <img src="./UML/timeAlgorithme.png">
# Sequence Diagrams
## Timeout
<img src="./UML/timeout.png">
# Tests # Tests
## Test 1 ## Test 1