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
4 changes: 2 additions & 2 deletions score/mw/com/design/runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ creation/instantiation of binding specific runtimes is done by `impl::Runtime` w

The class diagram of this design is as follows:

<img src="broken_link_k/swh/ddad_score/mw/com/design/runtime/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/runtime/runtime_structural_view.puml">

Since `impl::IRuntimeBinding` is only a **_very coarse grained_** interface and binding specific runtimes will have each
very specific methods/types, the binding specific code, which needs to access its specific binding runtime needs to do
a "downcast", when it gets a `IRuntimeBinding` instance from the binding independent `impl::Runtime`. The sequence is
shown in the following sequence diagram:

<img src="broken_link_k/swh/ddad_score/mw/com/design/runtime/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/runtime/runtime_sequence_view.puml">

## Static dependencies
Binding specific runtimes might use infrastructure in the form of static instances. E.g. the `lola::Runtime` uses
Expand Down
48 changes: 48 additions & 0 deletions score/mw/com/design/runtime/runtime_sequence_view.puml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return type should use the correct namespace separator. Please update impl::lola:IMessagePassingService& to impl::lola::IMessagePassingService&

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear @sahithi-nukala thank you for your review and providing suggestions. Due to amount of diagrams and size of them I would like you to provide your changes like this
#50 (review)
thanks in advance

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
@startuml runtime_sequence_view
title "Sequence View Runtime"
hide footbox

participant "<u>:impl::lola::<some class></u>" as lolaClass
participant "<u>static:impl::Runtime</u>" as staticRuntime
participant "singleton_instance:impl::Runtime" as runtimeInstance
participant "<u>:impl::RuntimeBindingFactory</u>\n<<plumbing>>" as bindingFactory
participant "<u>static:impl::lola::Runtime</u>" as staticLolaRuntime
participant "<u>:impl::lola::Runtime</u>" as lolaRuntime

activate staticRuntime
staticRuntime -> runtimeInstance : create(Configuration&)
activate runtimeInstance

runtimeInstance -> bindingFactory : CreateBindingRuntimes(Configuration&)
activate bindingFactory

bindingFactory -> bindingFactory : check via config, which binding runtimes to create

bindingFactory -> staticLolaRuntime : InitializeStaticDependencies()
activate staticLolaRuntime
staticLolaRuntime --> bindingFactory : return : void
deactivate staticLolaRuntime

bindingFactory -> lolaRuntime : create(Configuration&)
bindingFactory --> runtimeInstance : return : std::pair<>("loLa", std::unique_ptr<lola::Runtime>)
deactivate bindingFactory

runtimeInstance --> staticRuntime : return : impl::Runtime instance
deactivate runtimeInstance
deactivate staticRuntime

activate lolaClass
lolaClass -> staticRuntime : GetBindingRuntime(BindingType::LoLa)
activate staticRuntime
staticRuntime --> lolaClass : return : impl::IRuntimeBinding*
deactivate staticRuntime

lolaClass -> lolaClass : dynamic_cast<impl::lola::Runtime*>(impl::IRuntimeBinding*)

lolaClass -> lolaRuntime : GetLoLaMessaging()
activate lolaRuntime
lolaRuntime --> lolaClass : return : impl::lola::IMessagePassingService&
deactivate lolaRuntime
deactivate lolaClass

@enduml
79 changes: 79 additions & 0 deletions score/mw/com/design/runtime/runtime_structural_view.puml
Copy link
Contributor

@sahithi-nukala sahithi-nukala Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In PlantUML:
-runtime_bindings_ : std:unordered_map<BindingType, std::unique_ptr>

In Umlet:
-runtime_bindings_ : std::unordered_map<BindingType, std::unique_ptr>

Issue: The PlantUML version is missing a colon in the namespace — it incorrectly uses std:unordered_map instead of std::unordered_map.
Solution: Update the PlantUML line to:
-runtime_bindings_ : std::unordered_map<BindingType, std::unique_ptr>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear @sahithi-nukala thank you for your review and providing suggestions. Due to amount of diagrams and size of them I would like you to provide your changes like this
#50 (review)
thanks in advance

Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
@startuml runtime_structural_view
title "Structural View Runtime"

interface "mw::com::impl::IRuntime" as IRuntime {
+{abstract} resolve(const InstanceSpecifier&) : std::vector<InstanceIdentifier>
+{abstract} getBindingRuntime(BindingType binding) : IRuntimeBinding*
}

enum BindingType {
LoLa = 0
Fake = 1
}

class "mw::com::impl::Runtime" as Runtime {
-runtime_bindings_ : std::unordered_map<BindingType, std::unique_ptr<IRuntimeBinding>>
+{static} Initialize() : void
+{static} Initialize(int argc, score::StringLiteral argv) : void
+{static} Initialize(std::string const&) : void
+{static} getInstance() : Runtime&
+Runtime(Configuration&& config)
+resolve(const InstanceSpecifier&) : std::vector<InstanceIdentifier>
+getBindingRuntime(BindingType binding) : IRuntimeBinding*
..
<u>Notes:</u>
Runtime is not copyable.
}

class "mw::com::impl::RuntimeMock" as RuntimeMock {
+resolve(const InstanceSpecifier&): std::vector<InstanceIdentifier>
+GetBindingRuntime(BindingType binding): IRuntimeBinding*
..
Mock for unit-testing/mocking of Runtime func.
}

interface "mw::com::impl::IRuntimeBinding" as IRuntimeBinding {
+{abstract} GetBindingType() : BindingType
+{abstract} GetServiceDiscoveryClient() : IServiceDiscoveryClient&
+{abstract} GetTracingRuntime() : tracing::ITracingRuntimeBinding*
}

class "mw::com::impl::RuntimeBindingFactory" as RuntimeBindingFactory << plumbing >> {
+{static} CreateBindingRuntimes(configuration : Configuration&) : std::unordered_map<score::mw::com::impl::BindingType, std::unique_ptr<score::mw::com::impl::IRuntimeBinding>>
}

interface "mw::com::impl::lola::IRuntime" as LolaIRuntime {
+{abstract} HasAsilBSupport() : bool
+{abstract} GetLolaMessaging() : lola::IMessagePassingService&
+{abstract} GetShmSizeCalculationMode() : ShmSizeCalculationMode
+{abstract} GetRollbackSynchronization() : RollbackSynchronization&
+{abstract} GetPid() : pid_t
+{abstract} GetUid() : uid_t
}

class "mw::com::impl::lola:Runtime" as LolaRuntime {
-lola_message_passing_control_ : lola::MessagePassingControl
-lola_messaging_ : lola::MessagePassingFacade
+GetLolaMessaging() : lola::IMessagePassingService&
+HasAsilBSupport() : bool
+GetMessagePassingCfg(const QualityType asil_level) : MessagePassingFacade::AsilSpecificCfg
+GetRollbackSynchronization() : RollbackSynchronization&
}

class "mw::com::impl::lola:RuntimeMock" as LolaRuntimeMock {
+GetLolaMessaging() : lola::IMessagePassingService&
+HasAsilBSupport() : bool
}

IRuntime <|-- Runtime
IRuntime <|-- RuntimeMock
Runtime "1" *--> "0..n" IRuntimeBinding

IRuntimeBinding <|-- LolaIRuntime
LolaIRuntime <|-- LolaRuntime
LolaIRuntime <|-- LolaRuntimeMock

RuntimeBindingFactory ..> LolaRuntime : creates
Runtime ..> RuntimeBindingFactory : uses

@enduml
Loading
Loading