urtware / doc / statediagrams / subscriber / urtSubscriberFetchMessage.uml @ e48e1ccf
History | View | Annotate | Download (3.236 KB)
| 1 |
/' |
|---|---|
| 2 |
µRtWare is a lightweight publish/subscribe middleware for real-time |
| 3 |
applications. It was developed as part of the software habitat for the |
| 4 |
Autonomous Mini Robot [1] (AMiRo) but can be used for other purposes as well. |
| 5 |
|
| 6 |
Copyright (C) 2018..2019 Thomas Schöpping et al. |
| 7 |
|
| 8 |
This program is free software: you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation, either version 3 of the License, or |
| 11 |
(at your option) any later version. |
| 12 |
|
| 13 |
This program is distributed in the hope that it will be useful, |
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
GNU General Public License for more details. |
| 17 |
|
| 18 |
You should have received a copy of the GNU General Public License |
| 19 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 |
'/ |
| 21 |
|
| 22 |
@startuml |
| 23 |
|
| 24 |
title **µRtWare**\nurtSubscriberFetchMessage()\n |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
start |
| 29 |
note |
| 30 |
event received |
| 31 |
endnote |
| 32 |
:lock topic; |
| 33 |
note |
| 34 |
The message list is part of the topic and must be locked. |
| 35 |
endnote |
| 36 |
if (Is HRT subscriber?) then (yes) |
| 37 |
:lock next message; |
| 38 |
if (Fetch next or latest message?) then (next) |
| 39 |
else (latest) |
| 40 |
partition "iterate to latest" {
|
| 41 |
:lock next message; |
| 42 |
note |
| 43 |
locked two messaged ahead |
| 44 |
endnote |
| 45 |
while (Timestamp of next message is younger than current?) is (yes) |
| 46 |
fork |
| 47 |
fork |
| 48 |
:decremenet HRT counter of current message; |
| 49 |
fork again |
| 50 |
:update QoS delay timer (@subscriber); |
| 51 |
note |
| 52 |
no lock required since this timer is only accessed when the topic is locked |
| 53 |
endnote |
| 54 |
endfork |
| 55 |
:unlock current message; |
| 56 |
fork again |
| 57 |
:lock next message; |
| 58 |
endfork |
| 59 |
endwhile (no) |
| 60 |
:unlock next message; |
| 61 |
note |
| 62 |
one message ahead still locked |
| 63 |
but HRT counter not yet decremented |
| 64 |
endnote |
| 65 |
} |
| 66 |
endif |
| 67 |
fork |
| 68 |
:decrement HRT counter of current message; |
| 69 |
fork again |
| 70 |
:update QoS delay timer (@subscriber); |
| 71 |
note |
| 72 |
no lock required since this timer is only accessed when the topic is locked |
| 73 |
endnote |
| 74 |
endfork |
| 75 |
else (no) |
| 76 |
:lock last read message; |
| 77 |
if (Timestamp equals local copy?) then (yes) |
| 78 |
else (no) |
| 79 |
partition "find oldest valid message" {
|
| 80 |
:lock next message; |
| 81 |
while (Timestamp of next is younger then of current?) is (yes) |
| 82 |
fork |
| 83 |
:unlock current mesage; |
| 84 |
fork again |
| 85 |
:lock one message further ahaead; |
| 86 |
endfork |
| 87 |
endwhile (no) |
| 88 |
:unlock next message; |
| 89 |
} |
| 90 |
endif |
| 91 |
if (Fetch next or latest message?) then (next) |
| 92 |
else (latest) |
| 93 |
partition "iterate to latest" {
|
| 94 |
:lock next message; |
| 95 |
while (Timestamp of next message is younger then current?) is (yes) |
| 96 |
fork |
| 97 |
:unlock current message; |
| 98 |
fork again |
| 99 |
:lock next message; |
| 100 |
endfork |
| 101 |
endwhile (no) |
| 102 |
:unlock next message; |
| 103 |
note |
| 104 |
one message ahead still locked |
| 105 |
endnote |
| 106 |
} |
| 107 |
endif |
| 108 |
endif |
| 109 |
fork |
| 110 |
:set last fetched message pointer to locked message; |
| 111 |
fork again |
| 112 |
:copy timestamp of message; |
| 113 |
fork again |
| 114 |
if (Copy of payload requested?) then (yes) |
| 115 |
:copy message payload; |
| 116 |
else (no) |
| 117 |
endif |
| 118 |
endfork |
| 119 |
:unlock message; |
| 120 |
:unlock topic; |
| 121 |
stop |
| 122 |
|
| 123 |
@enduml |