Skip to content

Commit

Permalink
New intra-process communication design (#239)
Browse files Browse the repository at this point in the history
Signed-off-by: Soragna, Alberto <alberto.soragna@gmail.com>
  • Loading branch information
alsora authored Mar 30, 2020
1 parent b3b3b4d commit ccc7151
Show file tree
Hide file tree
Showing 7 changed files with 625 additions and 0 deletions.
498 changes: 498 additions & 0 deletions articles/intraprocess_communication.md

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions img/intraprocess_communication/intra_inter_process.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
@startuml

participant Publisher
participant IntraProcessManager
participant IntraProcessImpl
collections Subscriptions
participant ROS_Middleware

[-> Publisher: publish(unique_msg)

Publisher -> Publisher : promote unique_msg \nto shared_msg

Publisher -> IntraProcessManager : do_intra_process_publish(\nid, shared_msg)

IntraProcessManager -> IntraProcessImpl : get_subscription_ids_for_pub(id)

IntraProcessImpl --> IntraProcessManager : take_shared_ids, take_owned_ids

note left
these are lists of subscriptions
with QoS compatible with publisher
divided according to the type
stored in their buffers
end note

loop for id : take_shared_ids
IntraProcessManager -> IntraProcessImpl : get_subscription(id)

IntraProcessManager -> Subscriptions : add_message_to_buffer(shared_msg)

IntraProcessManager -> Subscriptions : trigger_guard_condition()
end

alt take_ownership_ids.size() > 0

IntraProcessManager -> IntraProcessManager : copy shared_msg \n to unique_msg

loop for id : take_owned_ids

IntraProcessManager -> IntraProcessImpl : get_subscription(id)

IntraProcessManager -> IntraProcessManager : Copy unique_msg\n (except last iter)

IntraProcessManager -> Subscriptions : add_message_to_buffer(unique_msg)

IntraProcessManager -> Subscriptions : trigger_guard_condition()
end

end

Publisher -> ROS_Middleware : do_inter_process_publish(shared_msg.get())

@enduml
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions img/intraprocess_communication/intra_process_only.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
@startuml

participant Publisher
participant IntraProcessManager
participant IntraProcessImpl
collections Subscriptions

[-> Publisher: publish(unique_msg)

Publisher -> IntraProcessManager : do_intra_process_publish(\nid, unique_msg)

IntraProcessManager -> IntraProcessImpl : get_subscription_ids_for_pub(id)

IntraProcessImpl --> IntraProcessManager : take_shared_ids, take_owned_ids
note left
these are lists of subscriptions
with QoS compatible with publisher
divided according to the type
stored in their buffers
end note

alt take_owned_ids.size() == 0

IntraProcessManager -> IntraProcessManager : promote unique_msg \nto shared_msg

loop for id : take_shared_ids
IntraProcessManager -> IntraProcessImpl : get_subscription(id)

IntraProcessManager -> Subscriptions : add_message_to_buffer(shared_msg)

IntraProcessManager -> Subscriptions : trigger_guard_condition()
end

else take_owned_ids.size() > 0 && take_shared_ids.size() <= 1

loop for id : (take_shared_ids + take_owned_ids)

IntraProcessManager -> IntraProcessImpl : get_subscription(id)

IntraProcessManager -> IntraProcessManager : Copy unique_msg\n (except last iter)

IntraProcessManager -> Subscriptions : add_message_to_buffer(unique_msg)

IntraProcessManager -> Subscriptions : trigger_guard_condition()
end


else take_owned_ids.size() > 0 && take_shared_ids.size() > 1

IntraProcessManager -> IntraProcessManager : copy unique_msg to shared_msg

loop for id : take_shared_ids
IntraProcessManager -> IntraProcessImpl : get_subscription(id)

IntraProcessManager -> Subscriptions : add_message_to_buffer(shared_msg)

IntraProcessManager -> Subscriptions : trigger_guard_condition()
end

loop for id : take_owned_ids

IntraProcessManager -> IntraProcessImpl : get_subscription(id)

IntraProcessManager -> IntraProcessManager : Copy unique_msg\n (except last iter)

IntraProcessManager -> Subscriptions : add_message_to_buffer(unique_msg)

IntraProcessManager -> Subscriptions : trigger_guard_condition()
end


end

@enduml
Binary file added img/intraprocess_communication/new_ipc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/intraprocess_communication/old_ipc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ccc7151

Please sign in to comment.