Skip to content

Commit d728421

Browse files
kalu-ancastler
authored andcommitted
mw/com: migrate_umlet_to_plantuml__service_discovery
Closes #48 Issue: SWP-208704 GIT_ORIGIN_SPP_REV_ID: 0f5b9af664ca6835e4f3c8caf28343c68d91d927
1 parent 9b60366 commit d728421

File tree

5 files changed

+230
-1377
lines changed

5 files changed

+230
-1377
lines changed

score/mw/com/design/service_discovery/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ will be represented by a flag file, and the path towards these files represent a
5252

5353
## Implementation
5454

55-
The following section gives a written explanation for the structural view that is illustrated in
56-
[Structural View](structural_view.uxf?ref=18c835c8d7b01056dd48f257c14f435795a48b7d)
55+
The following section gives a written explanation for the structural view that is illustrated in the following diagram.
5756

58-
![Structural View](broken_link_k/swh/ddad_score/mw/com/design/service_discovery/structural_view.uxf?ref=18c835c8d7b01056dd48f257c14f435795a48b7d)
57+
![STRUCTURAL_VIEW](broken_link_k/swh/safe-posix-platform/score/mw/com/design/service_discovery/structural_view.puml")
5958

6059
All possible user interactions with service discovery related functionalities are service specific. Since an API user
6160
should not bother about implementation specific representations of services (e.g. the service identifier),
@@ -117,7 +116,7 @@ As shown in [Sequential View](./sequence_view.uxf?ref=18c835c8d7b01056dd48f257c1
117116
`ServiceDiscovery` which directly dispatches the requests - based on the `InstanceIdentifier` - to either one or both
118117
bindings.
119118

120-
![Sequence View](broken_link_k/swh/ddad_score/mw/com/design/service_discovery/sequence_view.uxf?ref=18c835c8d7b01056dd48f257c14f435795a48b7d)
119+
![SEQUENCE_VIEW](broken_link_k/swh/safe-posix-platform/score/mw/com/design/service_discovery/sequence_view.puml")
121120

122121
In the special case of starting an asynchronous search for service instances (aka `StartFindService()`) a unique handle
123122
(`FindServiceHandle`) needs to be returned, to enable the user to later stop this search. This identifier needs to be
@@ -135,7 +134,7 @@ The callback will then construct the necessary `HandleTypes`, find the right `Fi
135134
the `ServiceDiscovery`
136135
and invoke it. What should be especially noted is, that in case of `ANY` semantics, the `InstanceIdentifier` provided
137136
to the `HandleType` needs to be bound to a specific setting. For example an instance id `ANY` would need to be replaced
138-
with a found one - for example _42_. The same is true for the binding type. Otherwise, a later construction of the Proxy
137+
with a found one - for example _42_. The same is true for the binding type. Otherwise, a later construction of the Proxy
139138
will fail.
140139

141140
### `LoLa` Service Discovery
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
@startuml sequence_view_service_discovery
2+
title "Sequence View Service Discovery"
3+
hide footbox
4+
5+
participant "<u>:User</u>" as User
6+
participant "<u>DummyProxy</u>" as DummyProxy
7+
participant "<u>:mw::com::impl::Runtime</u>" as Runtime
8+
participant "<u>:ServiceDiscovery</u>" as ServiceDiscovery
9+
participant "<u>:lola::IRuntime</u>" as LolaRuntime
10+
participant "<u>:lola::ServiceDiscoveryClient</u>" as ServiceDiscoveryClient
11+
participant "<u>:os::IONotify</u>" as IONotify
12+
participant "<u>:concurrency::Executor</u>" as Executor
13+
participant "<u>:SDTask</u>" as SDTask
14+
participant "<u>:FoundCallback</u>" as FoundCallback
15+
16+
User -> DummyProxy: StartFindService(\nFindHandler, InstanceSpecifier)
17+
activate DummyProxy
18+
19+
DummyProxy -> Runtime: getInstance()
20+
activate Runtime
21+
Runtime --> DummyProxy
22+
deactivate Runtime
23+
24+
DummyProxy -> Runtime: GetServiceDiscovery()
25+
activate Runtime
26+
Runtime --> DummyProxy
27+
deactivate Runtime
28+
29+
DummyProxy -> ServiceDiscovery: ...
30+
activate ServiceDiscovery
31+
32+
ServiceDiscovery -> Runtime: resolve(InstanceSpecifier):
33+
activate Runtime
34+
Runtime --> ServiceDiscovery: std::vector<InstanceIdentifier>
35+
deactivate Runtime
36+
37+
ServiceDiscovery -> ServiceDiscovery: GetNextHandle():\nFindServiceHandle
38+
39+
ServiceDiscovery -> ServiceDiscovery: Store FindHandler\nin map
40+
41+
ServiceDiscovery -> ServiceDiscovery: Store InstanceIdentifier\nin multi-map
42+
43+
loop for each InstanceIdentifier
44+
ServiceDiscovery -> Runtime: getBindingRuntime(\nInstanceIdentifier.instance_deployment_.bindingInfo_):
45+
activate Runtime
46+
Runtime --> ServiceDiscovery: lola::IRuntime*
47+
deactivate Runtime
48+
49+
ServiceDiscovery -> LolaRuntime: GetServiceDiscoveryClient()
50+
activate LolaRuntime
51+
LolaRuntime --> ServiceDiscovery: IServiceDiscoveryClient&
52+
deactivate LolaRuntime
53+
54+
ServiceDiscovery -> ServiceDiscoveryClient: StartFindService(FoundCallback, FindServiceHandle, InstanceIdentifier)
55+
activate ServiceDiscoveryClient
56+
57+
ServiceDiscoveryClient -> ServiceDiscoveryClient: InstanceIdentiferToPath()
58+
59+
ServiceDiscoveryClient -> IONotify: AddWatch(filesystem::Path)
60+
activate IONotify
61+
IONotify --> ServiceDiscoveryClient: watch_fd
62+
deactivate IONotify
63+
64+
ServiceDiscoveryClient -> ServiceDiscoveryClient: Store FoundCallback and Handle\nin multi-map with watch_fd
65+
66+
ServiceDiscoveryClient --> ServiceDiscovery
67+
deactivate ServiceDiscoveryClient
68+
end
69+
70+
ServiceDiscovery --> DummyProxy
71+
deactivate ServiceDiscovery
72+
73+
DummyProxy --> User
74+
deactivate DummyProxy
75+
76+
77+
78+
activate ServiceDiscoveryClient
79+
ServiceDiscoveryClient -> Executor: Submit(SDTask):
80+
activate Executor
81+
Executor -> SDTask: creates
82+
Executor --> ServiceDiscoveryClient
83+
deactivate Executor
84+
deactivate ServiceDiscoveryClient
85+
86+
activate SDTask
87+
loop while no stop
88+
SDTask -> IONotify: WaitForEvent()
89+
note left of IONotify: Note:\nThis wait is blocking for\nan OS Event
90+
activate IONotify
91+
IONotify --> SDTask: watch_fd
92+
deactivate IONotify
93+
94+
SDTask -> SDTask: Find watch_fd in\nsearch_requests
95+
96+
loop for each entry
97+
SDTask -> FoundCallback: invoke(FindServiceHandle)
98+
99+
activate FoundCallback
100+
FoundCallback -> ServiceDiscovery: GetInstanceIdentifierForFindHandle(FindServiceHandle)
101+
activate ServiceDiscovery
102+
ServiceDiscovery --> FoundCallback: std::vector<InstanceIdentifier>
103+
deactivate ServiceDiscovery
104+
105+
106+
107+
loop for each InstanceIdentifier
108+
FoundCallback -> FoundCallback: Create\nHandleType
109+
end
110+
111+
FoundCallback -> ServiceDiscovery: ExecuteUserCallback(std::vector<HandleType>, FindServiceHandle)
112+
activate ServiceDiscovery
113+
114+
ServiceDiscovery -> ServiceDiscovery: Find Callback\nin map
115+
116+
ServiceDiscovery -> ServiceDiscovery: Execute Callback\nfrom User
117+
118+
ServiceDiscovery --> FoundCallback: std::vector<InstanceIdentifier>
119+
deactivate ServiceDiscovery
120+
deactivate FoundCallback
121+
end
122+
end
123+
deactivate SDTask
124+
125+
@enduml

0 commit comments

Comments
 (0)