Skip to content

Commit

Permalink
create cmake infrastructure for durability
Browse files Browse the repository at this point in the history
Signed-off-by: TheFixer <[email protected]>
  • Loading branch information
TheFixer committed Sep 14, 2023
1 parent 256f539 commit 9a5479f
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ function(PREPEND var prefix)
set(${var} "${listVar}" PARENT_SCOPE)
endfunction()

# Durable support is currently under development (beta).
# Therefore it is disabled by default. To enable durable support
# in CycloneDDS use the build option '-DENABLE_DURABILITY'
# when building CycloneDDS

option(ENABLE_DURABILITY "Enable Durable support" OFF)
option(ENABLE_SECURITY "Enable OMG DDS Security support" ON)
option(ENABLE_LIFESPAN "Enable Lifespan QoS support" ON)
option(ENABLE_DEADLINE_MISSED "Enable Deadline Missed QoS support" ON)
Expand Down Expand Up @@ -99,6 +105,10 @@ if(NOT ENABLE_SECURITY)
message(STATUS "Building without OMG DDS Security support")
endif()

if(ENABLE_DURABILITY)
message(STATUS "Building with Durable support")
endif()

if(BUILD_TESTING)
add_subdirectory(ucunit)
endif()
Expand All @@ -108,4 +118,7 @@ if(BUILD_IDLC)
add_subdirectory(idl)
endif()
add_subdirectory(security)
if(ENABLE_DURABILITY)
add_subdirectory(durability)
endif()
add_subdirectory(core)
4 changes: 4 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ if(ENABLE_SECURITY)
$<BUILD_INTERFACE:$<TARGET_PROPERTY:security_api,INTERFACE_INCLUDE_DIRECTORIES>>)
endif()

if(ENABLE_DURABILITY)
target_link_libraries(ddsc PRIVATE "$<BUILD_INTERFACE:durability>")
endif()

if(ENABLE_SHM)
target_link_libraries(ddsc PRIVATE iceoryx_binding_c::iceoryx_binding_c)
endif()
Expand Down
9 changes: 9 additions & 0 deletions src/core/ddsc/src/dds_domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#include "dds__shm_monitor.h"
#endif

#ifdef DDS_HAS_DURABILITY
#include "dds/durability/dds_durability.h"
#endif

static dds_return_t dds_domain_free (dds_entity *vdomain);

const struct dds_entity_deriver dds_entity_deriver_domain = {
Expand Down Expand Up @@ -295,6 +299,11 @@ dds_entity_t dds_create_domain (const dds_domainid_t domain, const char *config)
const struct config_source config_src = { .kind = CFGKIND_XML, .u = { .xml = config } };
ret = dds_domain_create_internal_xml_or_raw (&dom, domain, false, &config_src);
dds_entity_unpin_and_drop_ref (&dds_global.m_entity);

#ifdef DDS_HAS_DURABILITY
dds_durability_init2(&dom->gv);
#endif

return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ddsrt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ set(DDSRT_WITH_LWIP ${WITH_LWIP})
set(DDSRT_WITH_FREERTOS ${WITH_FREERTOS})

foreach(feature SSL SECURITY LIFESPAN DEADLINE_MISSED NETWORK_PARTITIONS
SSM TYPELIB TYPE_DISCOVERY TOPIC_DISCOVERY SHM)
SSM TYPELIB TYPE_DISCOVERY TOPIC_DISCOVERY SHM DURABILITY)
set(DDS_HAS_${feature} ${ENABLE_${feature}})
endforeach()

Expand Down
3 changes: 3 additions & 0 deletions src/ddsrt/include/dds/features.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@
/* Whether or not support for Iceoryx support is included */
#cmakedefine DDS_HAS_SHM 1

/* Whether or not durable support is included */
#cmakedefine DDS_HAS_DURABILITY 1

#endif
36 changes: 36 additions & 0 deletions src/durability/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright(c) 2006 to 2021 ZettaScale Technology and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
set(source_dir "${CMAKE_CURRENT_SOURCE_DIR}")
set(binary_dir "${CMAKE_CURRENT_BINARY_DIR}")

add_library(durability INTERFACE)

target_include_directories(
durability INTERFACE
"$<BUILD_INTERFACE:${source_dir}/include>"
"$<BUILD_INTERFACE:${source_dir}/src>"
"$<BUILD_INTERFACE:${binary_dir}/include>")

set(headers
"${source_dir}/include/dds/durability/dds_durability.h")

set(sources
"${source_dir}/src/dds_durability.c")

target_sources(durability INTERFACE ${headers} ${sources})

install(
DIRECTORY
"${source_dir}/include/"
"${binary_dir}/include/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT dev
FILES_MATCHING PATTERN "*.h")
37 changes: 37 additions & 0 deletions src/durability/include/dds/durability/dds_durability.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright(c) 2006 to 2020 ZettaScale Technology and others
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
// v. 1.0 which is available at
// http://www.eclipse.org/org/documents/edl-v10.php.
//
// SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause

#ifndef DDS_DURABILITY_H
#define DDS_DURABILITY_H

#include "dds/ddsi/ddsi_domaingv.h"
#include "dds/ddsrt/retcode.h"
#include "ddsc/dds.h"
#include "dds__types.h"
#include "dds/ddsc/dds_rhc.h"

#if defined (__cplusplus)
extern "C" {
#endif

/* Integration functions for durability plugins */
typedef int (*plugin_init)(const char *argument, void **context, struct ddsi_domaingv *gv);
typedef int (*plugin_finalize)(void *context);

dds_return_t dds_durability_init2 (struct ddsi_domaingv* gv);
dds_return_t dds_durability_fini2 (void);
void dds_durability_new_local_reader (struct dds_reader *reader, struct dds_rhc *rhc);
void dds_durability_wait_for_ds (uint32_t quorum, dds_time_t timeout);

#if defined (__cplusplus)
}
#endif

#endif /* DDS_DURABILITY_H */
44 changes: 44 additions & 0 deletions src/durability/src/dds_durability.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright(c) 2006 to 2019 ADLINK Technology Limited and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#include "dds/durability/dds_durability.h"
#include "ddsc/dds.h"


dds_return_t dds_durability_init2 (struct ddsi_domaingv* gv)
{
printf("!!!!!!!!!!!!!!!!!!! src/durability/core/src/dds_durability_init()\n");
return DDS_RETCODE_OK;
}

dds_return_t dds_durability_fini2 (void)
{
printf("!!!!!!!!!!!!!!!!!!! src/durability/core/src/dds_durability_fini()\n");
return DDS_RETCODE_OK;
}

void dds_durability_new_local_reader (struct dds_reader *reader, struct dds_rhc *rhc)
{
/* create the administration to store transient data */
/* create a durability reader that sucks and stores it in the store */

DDSRT_UNUSED_ARG(reader);
return;
}

void dds_durability_wait_for_ds (uint32_t quorum, dds_time_t timeout)
{
(void)quorum;
(void)timeout;
return;
}


0 comments on commit 9a5479f

Please sign in to comment.