diff --git a/score/mw/com/design/runtime/README.md b/score/mw/com/design/runtime/README.md index 537decd1d..72e4b6103 100644 --- a/score/mw/com/design/runtime/README.md +++ b/score/mw/com/design/runtime/README.md @@ -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: - + 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: - + ## Static dependencies Binding specific runtimes might use infrastructure in the form of static instances. E.g. the `lola::Runtime` uses diff --git a/score/mw/com/design/runtime/runtime_sequence_view.puml b/score/mw/com/design/runtime/runtime_sequence_view.puml new file mode 100644 index 000000000..da1db9747 --- /dev/null +++ b/score/mw/com/design/runtime/runtime_sequence_view.puml @@ -0,0 +1,48 @@ +@startuml runtime_sequence_view +title "Sequence View Runtime" +hide footbox + +participant ":impl::lola::" as lolaClass +participant "static:impl::Runtime" as staticRuntime +participant "singleton_instance:impl::Runtime" as runtimeInstance +participant ":impl::RuntimeBindingFactory\n<>" as bindingFactory +participant "static:impl::lola::Runtime" as staticLolaRuntime +participant ":impl::lola::Runtime" 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) +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::IRuntimeBinding*) + +lolaClass -> lolaRuntime : GetLoLaMessaging() +activate lolaRuntime +lolaRuntime --> lolaClass : return : impl::lola::IMessagePassingService& +deactivate lolaRuntime +deactivate lolaClass + +@enduml \ No newline at end of file diff --git a/score/mw/com/design/runtime/runtime_structural_view.puml b/score/mw/com/design/runtime/runtime_structural_view.puml new file mode 100644 index 000000000..93c173bf0 --- /dev/null +++ b/score/mw/com/design/runtime/runtime_structural_view.puml @@ -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 + +{abstract} getBindingRuntime(BindingType binding) : IRuntimeBinding* +} + +enum BindingType { + LoLa = 0 + Fake = 1 +} + +class "mw::com::impl::Runtime" as Runtime { + -runtime_bindings_ : std::unordered_map> + +{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 + +getBindingRuntime(BindingType binding) : IRuntimeBinding* + .. + Notes: + Runtime is not copyable. +} + +class "mw::com::impl::RuntimeMock" as RuntimeMock { + +resolve(const InstanceSpecifier&): std::vector + +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> +} + +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 \ No newline at end of file diff --git a/score/mw/com/design/runtime/sequence_view.uxf b/score/mw/com/design/runtime/sequence_view.uxf deleted file mode 100644 index 854635e15..000000000 --- a/score/mw/com/design/runtime/sequence_view.uxf +++ /dev/null @@ -1,370 +0,0 @@ - - - 10 - - Relation - - 410 - 70 - 30 - 820 - - lt=. - 10.0;10.0;10.0;800.0 - - - UMLGeneric - - 320 - 50 - 220 - 30 - - _static:impl::Runtime_ - - - - UMLGeneric - - 800 - 170 - 20 - 240 - - - - - - UMLGeneric - - 410 - 110 - 20 - 310 - - - - - - UMLGeneric - - 660 - 110 - 320 - 30 - - singleton_instance:impl::Runtime - - - - Relation - - 800 - 130 - 30 - 780 - - lt=. - 10.0;10.0;10.0;760.0 - - - Relation - - 420 - 110 - 260 - 40 - - lt=<<- -create(Configuration&) - 240.0;20.0;10.0;20.0 - - - UMLGeneric - - 1090 - 50 - 230 - 50 - - _:impl::RuntimeBindingFactory_ -<<plumbing>> - - - - Relation - - 1200 - 90 - 30 - 800 - - lt=. - 10.0;10.0;10.0;780.0 - - - UMLGeneric - - 1200 - 160 - 20 - 220 - - - - - - Relation - - 810 - 160 - 410 - 40 - - lt=<<- -CreateBindingRuntimes(Configuration&) - 390.0;20.0;10.0;20.0 - - - UMLGeneric - - 1700 - 320 - 240 - 30 - - _:impl::lola::Runtime_ - - - - Relation - - 1210 - 320 - 510 - 40 - - lt=<- -create(Configuration&) - 490.0;20.0;10.0;20.0 - - - UMLGeneric - - 1400 - 60 - 240 - 30 - - _static:impl::lola::Runtime_ - - - - Relation - - 1510 - 80 - 30 - 810 - - lt=. - 10.0;10.0;10.0;790.0 - - - UMLGeneric - - 1510 - 260 - 20 - 30 - - - - - - Relation - - 1210 - 250 - 320 - 40 - - lt=<<- -InitializeStaticDependencies() - 300.0;20.0;10.0;20.0 - - - Relation - - 1210 - 270 - 320 - 40 - - lt=<<- -return : void - 10.0;20.0;300.0;20.0 - - - Relation - - 1800 - 340 - 30 - 600 - - lt=. - 10.0;10.0;10.0;580.0 - - - Relation - - 800 - 350 - 440 - 40 - - lt=<<- -return : std::pair<>("loLa", std::unique_ptr<lola::Runtime>) - 20.0;20.0;400.0;20.0 - - - Relation - - 1210 - 180 - 440 - 70 - - lt=<<- -check via config, which binding runtimes to create - 10.0;50.0;70.0;50.0;70.0;10.0;10.0;10.0 - - - Relation - - 420 - 380 - 400 - 40 - - lt=<<- -return : impl::Runtime instance - 10.0;20.0;380.0;20.0 - - - UMLGeneric - - 0 - 50 - 210 - 30 - - _:impl::lola::<some class>_ - - - - Relation - - 90 - 70 - 30 - 900 - - lt=. - 10.0;10.0;10.0;880.0 - - - UMLGeneric - - 90 - 620 - 20 - 230 - - - - - - UMLGeneric - - 410 - 610 - 20 - 80 - - - - - - Relation - - 100 - 620 - 330 - 40 - - lt=<<- -GetBindingRuntime(BindingType::LoLa) - 310.0;20.0;10.0;20.0 - - - Relation - - 100 - 650 - 330 - 40 - - lt=<<- -return : impl::IRuntimeBinding* - 10.0;20.0;310.0;20.0 - - - Relation - - 100 - 690 - 520 - 70 - - lt=<<- -dynamic_cast<impl::lola::Runtime*>(impl::IRuntimeBinding*) - 10.0;50.0;70.0;50.0;70.0;10.0;10.0;10.0 - - - UMLGeneric - - 1800 - 790 - 20 - 60 - - - - - - Relation - - 100 - 780 - 1720 - 40 - - lt=<<- -GetLoLaMessaging() - 1700.0;20.0;10.0;20.0 - - - Relation - - 100 - 810 - 1720 - 40 - - lt=<<- -return : impl::lola:IMessagePassingService& - 10.0;20.0;1700.0;20.0 - - diff --git a/score/mw/com/design/runtime/structural_view.uxf b/score/mw/com/design/runtime/structural_view.uxf deleted file mode 100644 index 7b9822f2b..000000000 --- a/score/mw/com/design/runtime/structural_view.uxf +++ /dev/null @@ -1,251 +0,0 @@ - - - 8 - - UMLClass - - 248 - 256 - 536 - 200 - - mw::com::impl::Runtime --- --runtime_bindings_ : std:unordered_map<BindingType, std::unique_ptr<IRuntimeBinding> > --- -_+Initialize() : void_ -_+Initialize(int argc, score::StringLiteral argv) : void_ -_+Initialize(std::string const&) : void_ -_+getInstance() : Runtime&_ - -+Runtime(Configuration&& config) -+resolve(const InstanceSpecifier&) : std::vector<InstanceIdentifier> -+getBindingRuntime(BindingType binding) : IRuntimeBinding* --- -Notes: -Runtime is not copyable. - - - - UMLClass - - 360 - 504 - 264 - 80 - - /mw::com::impl::IRuntimeBinding/ --- -/+GetBindingType() : BindingType/ -/+GetServiceDiscoveryClient() : IServiceDiscoveryClient&/ -/+GetTracingRuntime() : tracing::ITracingRuntimeBinding*/ - - - - UMLClass - - 688 - 504 - 672 - 80 - - <<plumbing>> -RuntimeBindingFactory --- -_+CreateBindingRuntimes(configuration : Configuration&) :_ -_std::unordered_map<score::mw::com::impl::BindingType, std::unique_ptr<score::mw::com::impl::IRuntimeBinding>>_ - - - - UMLClass - - 1024 - 112 - 128 - 80 - - BindingType -<<enumeration>> --- -- LoLa = 0 -- Fake = 1 - - - - UMLClass - - 384 - 832 - 544 - 112 - - mw::com::impl::lola:Runtime --- --lola_message_passing_control_ : lola::MessagePassingControl --lola_messaging_ : lola::MessagePassingFacade --- -+GetLolaMessaging() : lola::IMessagePassingService& -+HasAsilBSupport() : bool -+GetMessagePassingCfg(const QualityType asil_level) : MessagePassingFacade::AsilSpecificCfg -+GetRollbackSynchronization() : RollbackSynchronization& - - - - Relation - - 512 - 776 - 24 - 72 - - lt=<<- - 10.0;10.0;10.0;70.0 - - - Relation - - 376 - 448 - 48 - 72 - - lt=<<<<- -bg=black -m2=0..n - 10.0;10.0;10.0;70.0 - - - Relation - - 920 - 576 - 104 - 328 - - lt=<. -creates - 10.0;390.0;110.0;390.0;110.0;10.0 - - - UMLClass - - 320 - 112 - 448 - 64 - - /mw::com::impl::IRuntime/ --- -/+resolve(const InstanceSpecifier&) = 0: std::vector<InstanceIdentifier>/ -/+getBindingRuntime(BindingType binding) = 0: IRuntimeBinding*/ - - - - - - Relation - - 440 - 168 - 24 - 104 - - lt=<<- - 10.0;10.0;10.0;110.0 - - - UMLClass - - 0 - 832 - 376 - 88 - - mw::com::impl::lola:RuntimeMock --- -+GetLolaMessaging() : lola::IMessagePassingService& -+HasAsilBSupport() : bool --- - - - - Relation - - 248 - 696 - 88 - 152 - - lt=<<- - 90.0;10.0;10.0;10.0;10.0;170.0 - - - UMLClass - - 808 - 256 - 408 - 88 - - mw::com::impl::RuntimeMock --- -+resolve(const InstanceSpecifier&) : std::vector<InstanceIdentifier> -+GetBindingRuntime(BindingType binding) : IRuntimeBinding* --- -Mock for unit-testing/mocking of Runtime func. - - - - Relation - - 760 - 136 - 144 - 136 - - lt=<<- - 10.0;10.0;160.0;10.0;160.0;150.0 - - - UMLClass - - 320 - 664 - 384 - 120 - - /lola::IRuntime/ --- -/+HasAsilBSupport() : bool = 0/ -/+GetLolaMessaging() : lola::IMessagePassingService& = 0/ -/+GetShmSizeCalculationMode() : ShmSizeCalculationMode = 0/ -/+GetRollbackSynchronization() : RollbackSynchronization& = 0/ -/+GetPid() : pid_t = 0/ -/+GetUid() : uid_t = 0/ --- - - - - Relation - - 472 - 576 - 24 - 104 - - lt=<<- - 10.0;10.0;10.0;110.0 - - - Relation - - 776 - 432 - 96 - 88 - - lt=<. -uses - 70.0;90.0;70.0;10.0;10.0;10.0 - -