You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2020/02/11 19:49:31 UTC
[celix] branch feature/gh-142-rsa-issues updated: #142: Fixes an
issue in remote service etcd for configuring the ttl.
This is an automated email from the ASF dual-hosted git repository.
pnoltes pushed a commit to branch feature/gh-142-rsa-issues
in repository https://gitbox.apache.org/repos/asf/celix.git
The following commit(s) were added to refs/heads/feature/gh-142-rsa-issues by this push:
new abbe9e1 #142: Fixes an issue in remote service etcd for configuring the ttl.
abbe9e1 is described below
commit abbe9e1edb038c5e1dc2327851e681e020993e06
Author: Pepijn Noltes <pe...@gmail.com>
AuthorDate: Tue Feb 11 20:48:48 2020 +0100
#142: Fixes an issue in remote service etcd for configuring the ttl.
---
.travis.yml | 2 +-
CMakeLists.txt | 8 ++-
.../pubsub_discovery/src/pubsub_discovery_impl.c | 2 +-
.../discovery_etcd/src/discovery_impl.c | 12 +---
.../discovery_etcd/src/discovery_impl.h | 7 --
.../discovery_etcd/src/etcd_watcher.c | 74 +++++-----------------
.../discovery_etcd/src/etcd_watcher.h | 7 --
bundles/shell/shell/CMakeLists.txt | 6 +-
bundles/shell/shell/deprecated_api/command.h | 9 ++-
bundles/shell/shell/src/activator.c | 2 +-
bundles/shell/shell/src/shell.c | 4 +-
bundles/shell/shell/src/shell_private.h | 6 +-
bundles/shell/shell/test/CMakeLists.txt | 4 +-
bundles/shell/shell/test/src/shell_tests.cpp | 2 +-
libs/etcdlib/api/etcd.h | 30 ++++-----
15 files changed, 58 insertions(+), 117 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 2980ab1..33994bd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -88,7 +88,7 @@ before_script:
script:
- if [ "$SANITIZE" == 1 ]; then export BUILD_OPTIONS="${BUILD_OPTIONS} DENABLE_ADDRESS_SANITIZER=ON"; fi
- if [ "$USE_ZIP_INSTEAD_OF_JAR" == 1 ]; then export BUILD_OPTIONS="${BUILD_OPTIONS} -DDCELIX_USE_ZIP_INSTEAD_OF_JAR=ON"; fi
- - if [ "$ONLY_V3_API" == 1 ]; then export BUILD_OPTIONS="${BUILD_OPTIONS} -DCELIX_ADD_DEPRECATED_API=OFF"; fi
+ - if [ "$ONLY_V3_API" == 1 ]; then export BUILD_OPTIONS="${BUILD_OPTIONS} -DCELIX_INSTALL_DEPRECATED_API=OFF"; fi
- cd build
- if [ "$CC" = "gcc" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export BUILD_OPTS="${BUILD_OPTS} -DENABLE_CODE_COVERAGE=ON"; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ -z "$ANDROID" ]; then cmake -DCMAKE_BUILD_TYPE=Debug ${BUILD_OPTIONS} ${BUILD_OPTIONS_LINUX} -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ac6681b..a887f39 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,7 +99,13 @@ if (ENABLE_TESTING)
enable_testing()
endif()
-option(CELIX_ADD_DEPRECATED_API "whether to use and install deprecated apis (i.e. header without a celix_ prefix." ON)
+option(CELIX_INSTALL_DEPRECATED_API "whether to install (and use) deprecated apis (i.e. header without a celix_ prefix." ON)
+
+option(CELIX_ADD_DEPRECATED_ATTRIBUTES "If enabled add deprecated attributes to deprecated services/functions." ON)
+if (CELIX_ADD_DEPRECATED_ATTRIBUTES)
+ set(CMAKE_C_FLAGS "-DCELIX_ADD_DEPRECATED_ATTRIBUTES ${CMAKE_C_FLAGS}")
+ set(CMAKE_CXX_FLAGS "-DCELIX_ADD_DEPRECATED_ATTRIBUTES ${CMAKE_CXX_FLAGS}")
+endif ()
option(CELIX_ADD_OPENSSL_DEP "Enabled building Celix framework & etcdlib with OpenSSL library dependency. This can help in some libcurl resolving issues" OFF)
set(CELIX_OPTIONAL_EXTRA_LIBS "")
diff --git a/bundles/pubsub/pubsub_discovery/src/pubsub_discovery_impl.c b/bundles/pubsub/pubsub_discovery/src/pubsub_discovery_impl.c
index 3e9eab6..964afd9 100644
--- a/bundles/pubsub/pubsub_discovery/src/pubsub_discovery_impl.c
+++ b/bundles/pubsub/pubsub_discovery/src/pubsub_discovery_impl.c
@@ -164,7 +164,7 @@ static void psd_watchForChange(pubsub_discovery_t *disc, bool *connectedPtr, lon
char *action = NULL;
char *value = NULL;
char *readKey = NULL;
- //TODO add interruptable etcdlib_wait -> which returns a handle to interrupt and a can be used for a wait call
+ //TODO add interruptable etcdlib_watch -> which returns a handle to interrupt and a can be used for a wait call
int rc = etcdlib_watch(disc->etcdlib, disc->pubsubPath, watchIndex, &action, NULL, &value, &readKey, mIndex);
if (rc == ETCDLIB_RC_ERROR) {
L_ERROR("[PSD] Communicating with etcd. rc is %i, action value is %s\n", rc, action);
diff --git a/bundles/remote_services/discovery_etcd/src/discovery_impl.c b/bundles/remote_services/discovery_etcd/src/discovery_impl.c
index f4cd825..ecde542 100644
--- a/bundles/remote_services/discovery_etcd/src/discovery_impl.c
+++ b/bundles/remote_services/discovery_etcd/src/discovery_impl.c
@@ -16,13 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-/**
- * discovery_impl.c
- *
- * \date Aug 8, 2014
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
#include <stdio.h>
#include <stdlib.h>
@@ -31,16 +24,13 @@
#include <netdb.h>
#include <netinet/in.h>
-#include "celix_constants.h"
+
#include "celix_threads.h"
#include "bundle_context.h"
-#include "array_list.h"
#include "utils.h"
#include "celix_errno.h"
#include "filter.h"
#include "service_reference.h"
-#include "service_registration.h"
-#include "remote_constants.h"
#include "discovery.h"
diff --git a/bundles/remote_services/discovery_etcd/src/discovery_impl.h b/bundles/remote_services/discovery_etcd/src/discovery_impl.h
index adf8e4b..096ef4c 100644
--- a/bundles/remote_services/discovery_etcd/src/discovery_impl.h
+++ b/bundles/remote_services/discovery_etcd/src/discovery_impl.h
@@ -16,13 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-/**
- * discovery_impl.h
- *
- * \date Sep 29, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
#ifndef DISCOVERY_IMPL_H_
#define DISCOVERY_IMPL_H_
diff --git a/bundles/remote_services/discovery_etcd/src/etcd_watcher.c b/bundles/remote_services/discovery_etcd/src/etcd_watcher.c
index d464cf1..1c22422 100644
--- a/bundles/remote_services/discovery_etcd/src/etcd_watcher.c
+++ b/bundles/remote_services/discovery_etcd/src/etcd_watcher.c
@@ -16,22 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
-/**
- * etcd_watcher.c
- *
- * \date 16 Sep 2014
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
+#include "celix_api.h"
#include "log_helper.h"
#include "log_service.h"
-#include "celix_constants.h"
#include "utils.h"
#include "discovery.h"
#include "discovery_impl.h"
@@ -44,6 +37,7 @@
struct etcd_watcher {
etcdlib_t *etcdlib;
+ int ttl;
discovery_t *discovery;
log_helper_t **loghelper;
@@ -140,19 +134,17 @@ static celix_status_t etcdWatcher_addAlreadyExistingWatchpoints(etcd_watcher_t *
static celix_status_t etcdWatcher_addOwnFramework(etcd_watcher_t *watcher)
{
- celix_status_t status = CELIX_BUNDLE_EXCEPTION;
char localNodePath[MAX_LOCALNODE_LENGTH];
char *value;
char url[MAX_VALUE_LENGTH];
int modIndex;
char* endpoints = NULL;
- const char* ttlStr = NULL;
- int ttl;
celix_bundle_context_t *context = watcher->discovery->context;
endpoint_discovery_server_t *server = watcher->discovery->server;
// register own framework
+ celix_status_t status;
if ((status = etcdWatcher_getLocalNodePath(context, localNodePath)) != CELIX_SUCCESS) {
return status;
}
@@ -163,32 +155,17 @@ static celix_status_t etcdWatcher_addOwnFramework(etcd_watcher_t *watcher)
endpoints = url;
- if ((bundleContext_getProperty(context, CFG_ETCD_TTL, &ttlStr) != CELIX_SUCCESS) || !ttlStr) {
- ttl = DEFAULT_ETCD_TTL;
- }
- else
- {
- char* endptr = (char *) ttlStr;
- errno = 0;
- ttl = strtol(ttlStr, &endptr, 10);
- if (*endptr || errno != 0) {
- ttl = DEFAULT_ETCD_TTL;
- }
- }
+ watcher->ttl = celix_bundleContext_getPropertyAsLong(context, CFG_ETCD_TTL, DEFAULT_ETCD_TTL);
if (etcdlib_get(watcher->etcdlib, localNodePath, &value, &modIndex) != ETCDLIB_RC_OK) {
- etcdlib_set(watcher->etcdlib, localNodePath, endpoints, ttl, false);
- }
- else if (etcdlib_set(watcher->etcdlib, localNodePath, endpoints, ttl, true) != ETCDLIB_RC_OK) {
+ etcdlib_set(watcher->etcdlib, localNodePath, endpoints, watcher->ttl, false);
+ } else if (etcdlib_set(watcher->etcdlib, localNodePath, endpoints, watcher->ttl , true) != ETCDLIB_RC_OK) {
logHelper_log(*watcher->loghelper, OSGI_LOGSERVICE_WARNING, "Cannot register local discovery");
}
- else {
- status = CELIX_SUCCESS;
- }
FREE_MEM(value);
- return status;
+ return CELIX_SUCCESS;
}
@@ -281,8 +258,8 @@ static void* etcdWatcher_run(void* data) {
}
highestModified = modIndex;
- } else if (time(NULL) - timeBeforeWatch <= (DEFAULT_ETCD_TTL / 4)) {
- sleep(DEFAULT_ETCD_TTL / 4);
+ } else if (time(NULL) - timeBeforeWatch <= (watcher->ttl / 4)) {
+ sleep(watcher->ttl / 4);
}
FREE_MEM(action);
@@ -291,7 +268,7 @@ static void* etcdWatcher_run(void* data) {
FREE_MEM(rkey);
// update own framework uuid
- if (time(NULL) - timeBeforeWatch > (DEFAULT_ETCD_TTL / 4)) {
+ if (time(NULL) - timeBeforeWatch > (watcher->ttl / 4)) {
etcdWatcher_addOwnFramework(watcher);
timeBeforeWatch = time(NULL);
}
@@ -306,12 +283,6 @@ static void* etcdWatcher_run(void* data) {
*/
celix_status_t etcdWatcher_create(discovery_t *discovery, celix_bundle_context_t *context, etcd_watcher_t **watcher)
{
- celix_status_t status = CELIX_SUCCESS;
-
- const char* etcd_server = NULL;
- const char* etcd_port_string = NULL;
- int etcd_port = 0;
-
if (discovery == NULL) {
return CELIX_BUNDLE_EXCEPTION;
}
@@ -325,32 +296,17 @@ celix_status_t etcdWatcher_create(discovery_t *discovery, celix_bundle_context_t
(*watcher)->discovery = discovery;
(*watcher)->loghelper = &discovery->loghelper;
(*watcher)->entries = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
+ (*watcher)->ttl = DEFAULT_ETCD_TTL;
}
- if ((bundleContext_getProperty(context, CFG_ETCD_SERVER_IP, &etcd_server) != CELIX_SUCCESS) || !etcd_server) {
- etcd_server = DEFAULT_ETCD_SERVER_IP;
- }
+ const char* etcd_server = celix_bundleContext_getProperty(context, CFG_ETCD_SERVER_IP, DEFAULT_ETCD_SERVER_IP);
+ long etcd_port = celix_bundleContext_getPropertyAsLong(context, CFG_ETCD_SERVER_PORT, DEFAULT_ETCD_SERVER_PORT);
- if ((bundleContext_getProperty(context, CFG_ETCD_SERVER_PORT, &etcd_port_string) != CELIX_SUCCESS) || !etcd_port_string) {
- etcd_port = DEFAULT_ETCD_SERVER_PORT;
- }
- else
- {
- char* endptr = (char*)etcd_port_string;
- errno = 0;
- etcd_port = strtol(etcd_port_string, &endptr, 10);
- if (*endptr || errno != 0) {
- etcd_port = DEFAULT_ETCD_SERVER_PORT;
- }
- }
-
- (*watcher)->etcdlib = etcdlib_create(etcd_server, etcd_port, CURL_GLOBAL_DEFAULT);
+ (*watcher)->etcdlib = etcdlib_create(etcd_server, (int)etcd_port, CURL_GLOBAL_DEFAULT);
+ celix_status_t status = CELIX_SUCCESS;
if ((*watcher)->etcdlib == NULL) {
status = CELIX_BUNDLE_EXCEPTION;
- } else {
- status = CELIX_SUCCESS;
}
-
if (status == CELIX_SUCCESS) {
etcdWatcher_addOwnFramework(*watcher);
status = celixThreadMutex_create(&(*watcher)->watcherLock, NULL);
diff --git a/bundles/remote_services/discovery_etcd/src/etcd_watcher.h b/bundles/remote_services/discovery_etcd/src/etcd_watcher.h
index 67428ae..454a67e 100644
--- a/bundles/remote_services/discovery_etcd/src/etcd_watcher.h
+++ b/bundles/remote_services/discovery_etcd/src/etcd_watcher.h
@@ -16,13 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-/**
- * etcd_watcher.h
- *
- * \date 17 Sep 2014
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
#ifndef ETCD_WATCHER_H_
#define ETCD_WATCHER_H_
diff --git a/bundles/shell/shell/CMakeLists.txt b/bundles/shell/shell/CMakeLists.txt
index 1331823..ad65293 100644
--- a/bundles/shell/shell/CMakeLists.txt
+++ b/bundles/shell/shell/CMakeLists.txt
@@ -26,7 +26,7 @@ if (SHELL)
install(TARGETS shell_api EXPORT celix COMPONENT shell)
install(DIRECTORY api/ DESTINATION include/celix/shell COMPONENT shell)
- if (CELIX_ADD_DEPRECATED_API)
+ if (CELIX_INSTALL_DEPRECATED_API)
target_include_directories(shell_api INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/deprecated_api>)
install(DIRECTORY deprecated_api/ DESTINATION include/celix/shell COMPONENT shell)
endif ()
@@ -54,8 +54,8 @@ if (SHELL)
target_include_directories(shell PRIVATE src)
target_link_libraries(shell PRIVATE Celix::shell_api CURL::libcurl Celix::log_service_api Celix::log_helper)
target_compile_options(shell PRIVATE -Wno-deprecated-declarations)
- if (CELIX_ADD_DEPRECATED_API)
- target_compile_definitions(shell PRIVATE CELIX_ADD_DEPRECATED_API)
+ if (CELIX_INSTALL_DEPRECATED_API)
+ target_compile_definitions(shell PRIVATE CELIX_INSTALL_DEPRECATED_API)
endif ()
install_celix_bundle(shell EXPORT celix COMPONENT shell)
diff --git a/bundles/shell/shell/deprecated_api/command.h b/bundles/shell/shell/deprecated_api/command.h
index a65b3e3..0e63e63 100644
--- a/bundles/shell/shell/deprecated_api/command.h
+++ b/bundles/shell/shell/deprecated_api/command.h
@@ -33,6 +33,12 @@
typedef struct commandService command_service_t;
typedef command_service_t * command_service_pt;
+#ifdef CELIX_ADD_DEPRECATED_ATTRIBUTES
+#define DEP_ATTRIBUTE __attribute__((deprecated("command_service_t is replaced by celix_shell_command_t in celix_shell_command.h")))
+#else
+#define DEP_ATTRIBUTE
+#endif
+
/**
* The command service can be used to register additional shell commands.
* The service should be register with the following properties:
@@ -45,8 +51,7 @@ typedef command_service_t * command_service_pt;
struct commandService {
void *handle;
- celix_status_t (*executeCommand)(void *handle, char * commandLine, FILE *outStream, FILE *errorStream)
- __attribute__((deprecated("command_service_t is replaced by celix_shell_command_t in celix_shell_command.h")));
+ celix_status_t (*executeCommand)(void *handle, char * commandLine, FILE *outStream, FILE *errorStream) DEP_ATTRIBUTE;
};
diff --git a/bundles/shell/shell/src/activator.c b/bundles/shell/shell/src/activator.c
index 6e0d80c..34a531f 100644
--- a/bundles/shell/shell/src/activator.c
+++ b/bundles/shell/shell/src/activator.c
@@ -234,7 +234,7 @@ celix_status_t bundleActivator_start(void *activatorData, celix_bundle_context_t
}
activator->legacyTrackerId = -1L;
-#ifdef CELIX_ADD_DEPRECATED_API
+#ifdef CELIX_INSTALL_DEPRECATED_API
if (status == CELIX_SUCCESS) {
celix_service_tracking_options_t opts = CELIX_EMPTY_SERVICE_TRACKING_OPTIONS;
opts.callbackHandle = activator->shell;
diff --git a/bundles/shell/shell/src/shell.c b/bundles/shell/shell/src/shell.c
index 1c2375b..d25cf3a 100644
--- a/bundles/shell/shell/src/shell.c
+++ b/bundles/shell/shell/src/shell.c
@@ -114,7 +114,7 @@ celix_status_t shell_removeCommand(shell_t *shell, celix_shell_command_t *svc, c
return status;
}
-#ifdef CELIX_ADD_DEPRECATED_API
+#ifdef CELIX_INSTALL_DEPRECATED_API
celix_status_t shell_addLegacyCommand(shell_t *shell, command_service_t *svc, const celix_properties_t *props) {
celix_status_t status = CELIX_SUCCESS;
const char *name = celix_properties_get(props, OSGI_SHELL_COMMAND_NAME, NULL);
@@ -141,7 +141,7 @@ celix_status_t shell_addLegacyCommand(shell_t *shell, command_service_t *svc, co
}
#endif
-#ifdef CELIX_ADD_DEPRECATED_API
+#ifdef CELIX_INSTALL_DEPRECATED_API
celix_status_t shell_removeLegacyCommand(shell_t *shell, command_service_t *svc, const celix_properties_t *props) {
celix_status_t status = CELIX_SUCCESS;
const char *name = celix_properties_get(props, OSGI_SHELL_COMMAND_NAME, NULL);
diff --git a/bundles/shell/shell/src/shell_private.h b/bundles/shell/shell/src/shell_private.h
index 3b35c52..a185b05 100644
--- a/bundles/shell/shell/src/shell_private.h
+++ b/bundles/shell/shell/src/shell_private.h
@@ -26,7 +26,7 @@
#include "celix_shell_command.h"
#include "log_helper.h"
-#ifdef CELIX_ADD_DEPRECATED_API
+#ifdef CELIX_INSTALL_DEPRECATED_API
#include "command.h"
#endif
@@ -39,7 +39,7 @@ typedef struct celix_shell_command_entry {
} celix_shell_command_entry_t;
-#ifdef CELIX_ADD_DEPRECATED_API
+#ifdef CELIX_INSTALL_DEPRECATED_API
typedef struct celix_legacy_command_entry {
long svcId;
command_service_t *svc;
@@ -80,7 +80,7 @@ celix_status_t shell_getCommands(shell_t *shell, celix_array_list_t **commands);
celix_status_t shell_getCommandUsage(shell_t *shell, const char *commandName, char **outUsage);
celix_status_t shell_getCommandDescription(shell_t *shell, const char *commandName, char **outDescription);
-#ifdef CELIX_ADD_DEPRECATED_API
+#ifdef CELIX_INSTALL_DEPRECATED_API
celix_status_t shell_addLegacyCommand(shell_t *shell, command_service_t *svc, const celix_properties_t *props);
celix_status_t shell_removeLegacyCommand(shell_t *shell, command_service_t *svc, const celix_properties_t *props);
#endif
diff --git a/bundles/shell/shell/test/CMakeLists.txt b/bundles/shell/shell/test/CMakeLists.txt
index 868b05e..6df4b32 100644
--- a/bundles/shell/shell/test/CMakeLists.txt
+++ b/bundles/shell/shell/test/CMakeLists.txt
@@ -27,8 +27,8 @@ target_include_directories(test_shell PRIVATE ${CPPUTEST_INCLUDE_DIRS})
add_dependencies(test_shell shell_bundle)
target_compile_definitions(test_shell PRIVATE -DSHELL_BUNDLE_LOCATION=\"$<TARGET_PROPERTY:shell,BUNDLE_FILE>\")
target_compile_options(test_shell PRIVATE -Wno-deprecated-declarations)
-if (CELIX_ADD_DEPRECATED_API)
- target_compile_definitions(test_shell PRIVATE CELIX_ADD_DEPRECATED_API)
+if (CELIX_INSTALL_DEPRECATED_API)
+ target_compile_definitions(test_shell PRIVATE CELIX_INSTALL_DEPRECATED_API)
endif ()
add_test(NAME test_shell COMMAND test_shell)
diff --git a/bundles/shell/shell/test/src/shell_tests.cpp b/bundles/shell/shell/test/src/shell_tests.cpp
index 8074555..c0e09f4 100644
--- a/bundles/shell/shell/test/src/shell_tests.cpp
+++ b/bundles/shell/shell/test/src/shell_tests.cpp
@@ -174,7 +174,7 @@ TEST(CelixShellTests, localNameClashTest) {
}
-#ifdef CELIX_ADD_DEPRECATED_API
+#ifdef CELIX_INSTALL_DEPRECATED_API
#include "command.h"
TEST(CelixShellTests, legacyCommandTest) {
command_service_t cmdService;
diff --git a/libs/etcdlib/api/etcd.h b/libs/etcdlib/api/etcd.h
index e75e103..69456af 100644
--- a/libs/etcdlib/api/etcd.h
+++ b/libs/etcdlib/api/etcd.h
@@ -27,6 +27,12 @@ extern "C"
#include "etcdlib.h"
+#ifdef CELIX_ADD_DEPRECATED_ATTRIBUTES
+#define DEP_ATTRIBUTE __attribute__((deprecated("etcd_ call are placed by etcdlib_ calls, use etcdlib.h instead of etcd.h")))
+#else
+#define DEP_ATTRIBUTE
+#endif
+
/**
* @desc Initialize the ETCD-LIB with the server/port where Etcd can be reached.
* @param const char* server. String containing the IP-number of the server.
@@ -34,8 +40,7 @@ extern "C"
* @param int flags. bitwise flags to control etcdlib initialization.
* @return 0 on success, non zero otherwise.
*/
-//__attribute__((deprecated("use etcdlib_create instead")))
-int etcd_init(const char* server, int port, int flags);
+int etcd_init(const char* server, int port, int flags) DEP_ATTRIBUTE;
/**
* @desc Retrieve a single value from Etcd.
@@ -44,8 +49,7 @@ int etcd_init(const char* server, int port, int flags);
* @param int* modifiedIndex. If not NULL the Etcd-index of the last modified value.
* @return 0 on success, non zero otherwise
*/
-//__attribute__((deprecated("use etcdlib_get instead")))
-int etcd_get(const char* key, char** value, int* modifiedIndex);
+int etcd_get(const char* key, char** value, int* modifiedIndex) DEP_ATTRIBUTE;
/**
* @desc Retrieve the contents of a directory. For every found key/value pair the given callback function is called.
@@ -55,8 +59,7 @@ int etcd_get(const char* key, char** value, int* modifiedIndex);
* @param int* modifiedIndex. If not NULL the Etcd-index of the last modified value.
* @return 0 on success, non zero otherwise
*/
-//__attribute__((deprecated("use etcdlib_get_directory instead")))
-int etcd_get_directory(const char* directory, etcdlib_key_value_callback callback, void *arg, long long* modifiedIndex);
+int etcd_get_directory(const char* directory, etcdlib_key_value_callback callback, void *arg, long long* modifiedIndex) DEP_ATTRIBUTE;
/**
* @desc Setting an Etcd-key/value
@@ -66,8 +69,7 @@ int etcd_get_directory(const char* directory, etcdlib_key_value_callback callbac
* @param bool prevExist. If true the value is only set when the key already exists, if false it is always set
* @return 0 on success, non zero otherwise
*/
-//__attribute__((deprecated("use etcdlib_set instead")))
-int etcd_set(const char* key, const char* value, int ttl, bool prevExist);
+int etcd_set(const char* key, const char* value, int ttl, bool prevExist) DEP_ATTRIBUTE;
/**
* @desc Refresh the ttl of an existing key.
@@ -75,8 +77,7 @@ int etcd_set(const char* key, const char* value, int ttl, bool prevExist);
* @param ttl the ttl value to use.
* @return 0 on success, non zero otherwise.
*/
-//__attribute__((deprecated("use etcdlib_refesh instead")))
-int etcd_refresh(const char *key, int ttl);
+int etcd_refresh(const char *key, int ttl) DEP_ATTRIBUTE;
/**
* @desc Setting an Etcd-key/value and checks if there is a different previous value
@@ -86,16 +87,14 @@ int etcd_refresh(const char *key, int ttl);
* @param bool always_write. If true the value is written, if false only when the given value is equal to the value in etcd.
* @return 0 on success, non zero otherwise
*/
-//__attribute__((deprecated("use etcdlib_set_with_check instead")))
-int etcd_set_with_check(const char* key, const char* value, int ttl, bool always_write);
+int etcd_set_with_check(const char* key, const char* value, int ttl, bool always_write) DEP_ATTRIBUTE;
/**
* @desc Deleting an Etcd-key
* @param const char* key. The Etcd-key (Note: a leading '/' should be avoided)
* @return 0 on success, non zero otherwise
*/
-//__attribute__((deprecated("use etcdlib_del instead")))
-int etcd_del(const char* key);
+int etcd_del(const char* key) DEP_ATTRIBUTE;
/**
* @desc Watching an etcd directory for changes
@@ -108,8 +107,7 @@ int etcd_del(const char* key);
* @param long long* modifiedIndex. If not NULL, the index of the modification is written.
* @return ETCDLIB_RC_OK (0) on success, non zero otherwise. Note that a timeout is signified by a ETCDLIB_RC_TIMEOUT return code.
*/
-//__attribute__((deprecated("use etcdlib_watch instead")))
-int etcd_watch(const char* key, long long index, char** action, char** prevValue, char** value, char** rkey, long long* modifiedIndex);
+int etcd_watch(const char* key, long long index, char** action, char** prevValue, char** value, char** rkey, long long* modifiedIndex) DEP_ATTRIBUTE;
#ifdef __cplusplus
}