|
| 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