Skip to content

Commit

Permalink
Merge remote-tracking branch 'zenoh/dev/1.0.0' into ahcorde/dev/1.0.0…
Browse files Browse the repository at this point in the history
…-cpp
  • Loading branch information
ahcorde committed Dec 3, 2024
2 parents b563282 + 435186a commit 9e24ad9
Show file tree
Hide file tree
Showing 22 changed files with 85 additions and 30 deletions.
9 changes: 5 additions & 4 deletions rmw_zenoh_cpp/src/detail/graph_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <memory>
#include <mutex>
#include <optional>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
Expand Down Expand Up @@ -612,10 +613,10 @@ void GraphCache::parse_del(

if (entity->type() == EntityType::Node) {
// Node
// In case the remote Node closed abruptly or was disconnected, Zenoh could deliver the
// liveliness tokens unregistration events in any order.
// If the event for Node unregistration comes before the unregistration of its
// pubs/subs/services, we should update the count in graph_topics_ and graph_services_.
// When destroying a node, Zenoh does not guarantee that liveliness tokens to remove pub/subs
// arrive before the one to remove the node from the graph despite un-registering those entities
// earlier. In such scenarios, if we find any pub/subs present in the node, we reduce their
// counts in graph_topics_.
const GraphNodePtr graph_node = node_it->second;
if (!graph_node->pubs_.empty() ||
!graph_node->subs_.empty() ||
Expand Down
6 changes: 4 additions & 2 deletions rmw_zenoh_cpp/src/detail/graph_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include "event.hpp"
#include "liveliness_utils.hpp"
#include "ordered_map.hpp"

#include "rcutils/allocator.h"
#include "rcutils/types/string_array.h"
#include "rcutils/types.h"

#include "rmw/topic_endpoint_info_array.h"
#include "rmw/rmw.h"
#include "rmw/get_topic_endpoint_info.h"
#include "rmw/names_and_types.h"


Expand Down
3 changes: 3 additions & 0 deletions rmw_zenoh_cpp/src/detail/liveliness_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <sstream>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>
Expand All @@ -31,6 +32,8 @@
#include "qos.hpp"
#include "simplified_xxhash3.hpp"

#include "rcpputils/scope_exit.hpp"

#include "rmw/error_handling.h"

namespace rmw_zenoh_cpp
Expand Down
1 change: 1 addition & 0 deletions rmw_zenoh_cpp/src/detail/liveliness_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <memory>
#include <optional>
#include <string>
#include <vector>

#include <zenoh.hxx>

Expand Down
8 changes: 8 additions & 0 deletions rmw_zenoh_cpp/src/detail/rmw_client_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,31 @@
#include <fastcdr/FastBuffer.h>

#include <chrono>
#include <cinttypes>
#include <limits>
#include <memory>
#include <mutex>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#include <zenoh.hxx>

#include "attachment_helpers.hpp"
#include "cdr.hpp"
#include "liveliness_utils.hpp"
#include "logging_macros.hpp"
#include "message_type_support.hpp"
#include "qos.hpp"
#include "rmw_context_impl_s.hpp"

#include "rcpputils/scope_exit.hpp"

#include "rmw/error_handling.h"
#include "rmw/get_topic_endpoint_info.h"
#include "rmw/impl/cpp/macros.hpp"

namespace rmw_zenoh_cpp
{
Expand Down
7 changes: 7 additions & 0 deletions rmw_zenoh_cpp/src/detail/rmw_client_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,22 @@
#include <deque>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <unordered_map>

#include <zenoh.hxx>

#include "event.hpp"
#include "liveliness_utils.hpp"
#include "message_type_support.hpp"
#include "service_type_support.hpp"
#include "type_support_common.hpp"
#include "zenoh_utils.hpp"

#include "rcutils/allocator.h"

#include "rmw/rmw.h"
#include "rmw/ret_types.h"

namespace rmw_zenoh_cpp
Expand Down
11 changes: 1 addition & 10 deletions rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "rmw_context_impl_s.hpp"

#include <chrono>
#include <cstddef>
#include <cstdint>
#include <memory>
Expand Down Expand Up @@ -41,16 +42,6 @@
// TODO(clalancette): Make this configurable, or get it from the configuration
#define SHM_BUFFER_SIZE_MB 10

// The variable is used to identify whether the process is trying to exit or not.
// The atexit function we registered will set the flag and prevent us from closing
// Zenoh Session. Zenoh API can't be used in atexit function, because Tokio context
// is already destroyed. It will cause panic if we do so.
static bool is_exiting = false;
void update_is_exiting()
{
is_exiting = true;
}

// This global mapping of raw Data pointers to Data shared pointers allows graph_sub_data_handler()
// to lookup the pointer, and gain a reference to a shared_ptr if it exists.
// This guarantees that the Data object will not be destroyed while we are using it.
Expand Down
2 changes: 2 additions & 0 deletions rmw_zenoh_cpp/src/detail/rmw_node_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include "rmw_subscription_data.hpp"
#include "rmw_service_data.hpp"

#include "rmw/rmw.h"

namespace rmw_zenoh_cpp
{
///=============================================================================
Expand Down
3 changes: 3 additions & 0 deletions rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@

#include <fastcdr/FastBuffer.h>

#include <cinttypes>
#include <memory>
#include <mutex>
#include <string>
#include <utility>
#include <vector>

#include "cdr.hpp"
#include "rmw_context_impl_s.hpp"
#include "message_type_support.hpp"
#include "logging_macros.hpp"
#include "qos.hpp"
Expand All @@ -32,6 +34,7 @@

#include "rmw/error_handling.h"
#include "rmw/get_topic_endpoint_info.h"
#include "rmw/impl/cpp/macros.hpp"

namespace rmw_zenoh_cpp
{
Expand Down
4 changes: 4 additions & 0 deletions rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
#include "event.hpp"
#include "liveliness_utils.hpp"
#include "message_type_support.hpp"
#include "type_support_common.hpp"

#include "rcutils/allocator.h"

#include "rmw/rmw.h"
#include "rmw/ret_types.h"

namespace rmw_zenoh_cpp
Expand Down
5 changes: 5 additions & 0 deletions rmw_zenoh_cpp/src/detail/rmw_service_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <fastcdr/FastBuffer.h>

#include <cinttypes>
#include <memory>
#include <mutex>
#include <string>
Expand All @@ -27,12 +28,16 @@

#include "attachment_helpers.hpp"
#include "cdr.hpp"
#include "rmw_context_impl_s.hpp"
#include "message_type_support.hpp"
#include "logging_macros.hpp"
#include "qos.hpp"

#include "rcpputils/scope_exit.hpp"

#include "rmw/error_handling.h"
#include "rmw/get_topic_endpoint_info.h"
#include "rmw/impl/cpp/macros.hpp"

namespace rmw_zenoh_cpp
{
Expand Down
6 changes: 6 additions & 0 deletions rmw_zenoh_cpp/src/detail/rmw_service_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,22 @@
#include <deque>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <unordered_map>

#include <zenoh.hxx>

#include "event.hpp"
#include "liveliness_utils.hpp"
#include "message_type_support.hpp"
#include "service_type_support.hpp"
#include "type_support_common.hpp"
#include "zenoh_utils.hpp"

#include "rcutils/allocator.h"

#include "rmw/rmw.h"
#include "rmw/ret_types.h"

namespace rmw_zenoh_cpp
Expand Down
5 changes: 3 additions & 2 deletions rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <fastcdr/FastBuffer.h>

#include <cinttypes>
#include <limits>
#include <memory>
#include <mutex>
Expand All @@ -26,16 +27,16 @@
#include "attachment_helpers.hpp"
#include "cdr.hpp"
#include "identifier.hpp"
#include "rmw_context_impl_s.hpp"
#include "message_type_support.hpp"
#include "logging_macros.hpp"
#include "qos.hpp"
// Use the implemented rmw_context_impl_t
#include "rmw_context_impl_s.hpp"

#include "rcpputils/scope_exit.hpp"

#include "rmw/error_handling.h"
#include "rmw/get_topic_endpoint_info.h"
#include "rmw/impl/cpp/macros.hpp"

namespace rmw_zenoh_cpp
{
Expand Down
2 changes: 2 additions & 0 deletions rmw_zenoh_cpp/src/detail/type_support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// https://github.com/ros2/rmw_fastrtps/blob/469624e3d483290d6f88fe4b89ee5feaa7694e61/rmw_fastrtps_cpp/src/type_support_common.hpp

#include <cassert>
#include <functional>
#include <memory>

#include "rmw/error_handling.h"

Expand Down
3 changes: 0 additions & 3 deletions rmw_zenoh_cpp/src/detail/zenoh_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

#include <limits>
#include <string>
#include <unordered_map>
#include <utility>

#include <zenoh.hxx>
#include <zenoh/api/config.hxx>
Expand Down Expand Up @@ -63,7 +61,6 @@ std::optional<zenoh::Config> _get_z_config(
// If the environment variable is set, try to read the configuration from the file,
// if the environment variable is not set use internal configuration
configured_uri = envar_uri[0] != '\0' ? envar_uri : default_uri;

// Try to read the configuration
zenoh::ZResult err;
zenoh::Config config = zenoh::Config::from_file(configured_uri, &err);
Expand Down
2 changes: 2 additions & 0 deletions rmw_zenoh_cpp/src/detail/zenoh_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#define DETAIL__ZENOH_CONFIG_HPP_

#include <optional>
#include <unordered_map>
#include <utility>

#include <zenoh.hxx>
#include <zenoh/api/config.hxx>
Expand Down
9 changes: 7 additions & 2 deletions rmw_zenoh_cpp/src/detail/zenoh_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
#include "zenoh_utils.hpp"

#include <chrono>
#include <cinttypes>
#include <utility>

#include "attachment_helpers.hpp"
#include "rmw/types.h"
#include "rcpputils/scope_exit.hpp"

#include "rmw/error_handling.h"

namespace rmw_zenoh_cpp
{
Expand All @@ -35,7 +38,9 @@ zenoh::Bytes create_map_and_set_sequence_num(
}

///=============================================================================
ZenohQuery::ZenohQuery(const zenoh::Query & query, std::chrono::nanoseconds::rep received_timestamp)
ZenohQuery::ZenohQuery(
const zenoh::Query & query,
std::chrono::nanoseconds::rep received_timestamp)
{
query_ = query.clone();
received_timestamp_ = received_timestamp;
Expand Down
1 change: 1 addition & 0 deletions rmw_zenoh_cpp/src/detail/zenoh_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <zenoh.hxx>

#include <chrono>
#include <functional>
#include <optional>

#include "rmw/types.h"
Expand Down
1 change: 1 addition & 0 deletions rmw_zenoh_cpp/src/rmw_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "rmw/error_handling.h"
#include "rmw/event.h"
#include "rmw/events_statuses/events_statuses.h"
#include "rmw/types.h"

#include "detail/event.hpp"
Expand Down
6 changes: 6 additions & 0 deletions rmw_zenoh_cpp/src/rmw_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@
// limitations under the License.

#include <string>
#include <thread>

#include <zenoh.hxx>

#include "detail/identifier.hpp"
#include "detail/liveliness_utils.hpp"
#include "detail/rmw_context_impl_s.hpp"
#include "detail/zenoh_config.hpp"

#include "rcutils/env.h"
#include "detail/logging_macros.hpp"
#include "rcutils/strdup.h"
#include "rcutils/types.h"

#include "rmw/init.h"
#include "rmw/impl/cpp/macros.hpp"
Expand Down
1 change: 1 addition & 0 deletions rmw_zenoh_cpp/src/rmw_init_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "rcutils/allocator.h"
#include "rcutils/strdup.h"
#include "rcutils/types.h"

#include "rmw/impl/cpp/macros.hpp"
#include "rmw/init_options.h"
Expand Down
Loading

0 comments on commit 9e24ad9

Please sign in to comment.