Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions score/mw/com/design/service_discovery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ will be represented by a flag file, and the path towards these files represent a

## Implementation

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

![Structural View](broken_link_k/swh/ddad_score/mw/com/design/service_discovery/structural_view.uxf?ref=18c835c8d7b01056dd48f257c14f435795a48b7d)
<img src="https://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/eclipse-score/communication/refs/heads/main/score/mw/com/design/service_discovery/structural_view.puml" />

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

![Sequence View](broken_link_k/swh/ddad_score/mw/com/design/service_discovery/sequence_view.uxf?ref=18c835c8d7b01056dd48f257c14f435795a48b7d)
<img src="https://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/eclipse-score/communication/refs/heads/main/score/mw/com/design/service_discovery/sequence_view.puml" />

In the special case of starting an asynchronous search for service instances (aka `StartFindService()`) a unique handle
(`FindServiceHandle`) needs to be returned, to enable the user to later stop this search. This identifier needs to be
Expand Down
125 changes: 125 additions & 0 deletions score/mw/com/design/service_discovery/sequence_view.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
@startuml sequence_view_service_discovery
title "Sequence View Service Discovery"
hide footbox

participant "<u>:User</u>" as User
participant "<u>DummyProxy</u>" as DummyProxy
participant "<u>:mw::com::impl::Runtime</u>" as Runtime
participant "<u>:ServiceDiscovery</u>" as ServiceDiscovery
participant "<u>:lola::IRuntime</u>" as LolaRuntime
participant "<u>:lola::ServiceDiscoveryClient</u>" as ServiceDiscoveryClient
participant "<u>:os::IONotify</u>" as IONotify
participant "<u>:concurrency::Executor</u>" as Executor
participant "<u>:SDTask</u>" as SDTask
participant "<u>:FoundCallback</u>" as FoundCallback

User -> DummyProxy: StartFindService(\nFindHandler, InstanceSpecifier)
activate DummyProxy

DummyProxy -> Runtime: getInstance()
activate Runtime
Runtime --> DummyProxy
deactivate Runtime

DummyProxy -> Runtime: GetServiceDiscovery()
activate Runtime
Runtime --> DummyProxy
deactivate Runtime

DummyProxy -> ServiceDiscovery: ...
activate ServiceDiscovery

ServiceDiscovery -> Runtime: resolve(InstanceSpecifier):
activate Runtime
Runtime --> ServiceDiscovery: std::vector<InstanceIdentifier>
deactivate Runtime

ServiceDiscovery -> ServiceDiscovery: GetNextHandle():\nFindServiceHandle

ServiceDiscovery -> ServiceDiscovery: Store FindHandler\nin map

ServiceDiscovery -> ServiceDiscovery: Store InstanceIdentifier\nin multi-map

loop for each InstanceIdentifier
ServiceDiscovery -> Runtime: getBindingRuntime(\nInstanceIdentifier.instance_deployment_.bindingInfo_):
activate Runtime
Runtime --> ServiceDiscovery: lola::IRuntime*
deactivate Runtime

ServiceDiscovery -> LolaRuntime: GetServiceDiscoveryClient()
activate LolaRuntime
LolaRuntime --> ServiceDiscovery: IServiceDiscoveryClient&
deactivate LolaRuntime

ServiceDiscovery -> ServiceDiscoveryClient: StartFindService(FoundCallback, FindServiceHandle, InstanceIdentifier)
activate ServiceDiscoveryClient

ServiceDiscoveryClient -> ServiceDiscoveryClient: InstanceIdentiferToPath()

ServiceDiscoveryClient -> IONotify: AddWatch(filesystem::Path)
activate IONotify
IONotify --> ServiceDiscoveryClient: watch_fd
deactivate IONotify

ServiceDiscoveryClient -> ServiceDiscoveryClient: Store FoundCallback and Handle\nin multi-map with watch_fd

ServiceDiscoveryClient --> ServiceDiscovery
deactivate ServiceDiscoveryClient
end

ServiceDiscovery --> DummyProxy
deactivate ServiceDiscovery

DummyProxy --> User
deactivate DummyProxy



activate ServiceDiscoveryClient
ServiceDiscoveryClient -> Executor: Submit(SDTask):
activate Executor
Executor -> SDTask: creates
Executor --> ServiceDiscoveryClient
deactivate Executor
deactivate ServiceDiscoveryClient

activate SDTask
loop while no stop
SDTask -> IONotify: WaitForEvent()
note left of IONotify: Note:\nThis wait is blocking for\nan OS Event
activate IONotify
IONotify --> SDTask: watch_fd
deactivate IONotify

SDTask -> SDTask: Find watch_fd in\nsearch_requests

loop for each entry
SDTask -> FoundCallback: invoke(FindServiceHandle)

activate FoundCallback
FoundCallback -> ServiceDiscovery: GetInstanceIdentifierForFindHandle(FindServiceHandle)
activate ServiceDiscovery
ServiceDiscovery --> FoundCallback: std::vector<InstanceIdentifier>
deactivate ServiceDiscovery



loop for each InstanceIdentifier
FoundCallback -> FoundCallback: Create\nHandleType
end

FoundCallback -> ServiceDiscovery: ExecuteUserCallback(std::vector<HandleType>, FindServiceHandle)
activate ServiceDiscovery

ServiceDiscovery -> ServiceDiscovery: Find Callback\nin map

ServiceDiscovery -> ServiceDiscovery: Execute Callback\nfrom User

ServiceDiscovery --> FoundCallback: std::vector<InstanceIdentifier>
deactivate ServiceDiscovery
deactivate FoundCallback
end
end
deactivate SDTask

@enduml
Loading