Skip to content

Commit

Permalink
Merge pull request #47 from nacos-group/develop
Browse files Browse the repository at this point in the history
nacos-sdk-cpp 1.0.3
  • Loading branch information
TTTTTAAAAAKKKKEEEENNNN authored Jan 11, 2021
2 parents 5c0b75b + 75d8642 commit c29099a
Show file tree
Hide file tree
Showing 99 changed files with 1,705 additions and 1,049 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Create a file named IntegratingIntoYourProject.cpp:
#include "PropertyKeyConst.h"
#include "DebugAssertion.h"
#include "ResourceGuard.h"
#include "Debug.h"
#include "Logger.h"
#include "NacosString.h"

using namespace std;
Expand Down Expand Up @@ -98,7 +98,7 @@ or you can use ldconfig to add libnacos-cli.so to your lib path.
#include "PropertyKeyConst.h"
#include "DebugAssertion.h"
#include "ResourceGuard.h"
#include "Debug.h"
#include "Logger.h"

using namespace std;
using namespace nacos;
Expand Down Expand Up @@ -136,7 +136,7 @@ int main() {
#include "ResourceGuard.h"
#include "PropertyKeyConst.h"
#include "DebugAssertion.h"
#include "Debug.h"
#include "Logger.h"

using namespace std;
using namespace nacos;
Expand Down Expand Up @@ -187,7 +187,7 @@ int main() {
#include "listen/Listener.h"
#include "PropertyKeyConst.h"
#include "DebugAssertion.h"
#include "Debug.h"
#include "Logger.h"

using namespace std;
using namespace nacos;
Expand Down Expand Up @@ -246,7 +246,7 @@ int main() {
#include "utils/UtilAndComs.h"
#include "http/HTTPCli.h"
#include "DebugAssertion.h"
#include "Debug.h"
#include "Logger.h"
#include "NacosString.h"
#include "Properties.h"
#include "PropertyKeyConst.h"
Expand Down Expand Up @@ -310,7 +310,7 @@ int main() {
#include "naming/subscribe/EventListener.h"
#include "PropertyKeyConst.h"
#include "DebugAssertion.h"
#include "Debug.h"
#include "Logger.h"

using namespace std;
using namespace nacos;
Expand All @@ -337,7 +337,7 @@ int main() {
props[PropertyKeyConst::SERVER_ADDR] = "127.0.0.1:8848";
//Interval for poller to check the status of subscribed services(unit:Ms), 30000 by default
//Here we set it to 5000 to see the output more quick
props[PropertyKeyConst::TCP_NAMING_POLL_INTERVAL] = "5000";
props[PropertyKeyConst::SUBSCRIPTION_POLL_INTERVAL] = "5000";
NacosServiceFactory *factory = new NacosServiceFactory(props);
ResourceGuard <NacosServiceFactory> _guardFactory(factory);
NamingService *n = factory->CreateNamingService();
Expand Down Expand Up @@ -375,7 +375,7 @@ int main() {
#include "utils/UtilAndComs.h"
#include "http/HTTPCli.h"
#include "DebugAssertion.h"
#include "Debug.h"
#include "Logger.h"
#include "NacosString.h"
#include "Properties.h"
#include "PropertyKeyConst.h"
Expand Down
16 changes: 8 additions & 8 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Nacos-sdk-cpp是nacos客戶端的C++版本,它支持服务发现和动态配
#include "PropertyKeyConst.h"
#include "DebugAssertion.h"
#include "ResourceGuard.h"
#include "Debug.h"
#include "Logger.h"
#include "NacosString.h"

using namespace std;
Expand Down Expand Up @@ -93,7 +93,7 @@ int main() {
#include "PropertyKeyConst.h"
#include "DebugAssertion.h"
#include "ResourceGuard.h"
#include "Debug.h"
#include "Logger.h"

using namespace std;
using namespace nacos;
Expand Down Expand Up @@ -131,7 +131,7 @@ int main() {
#include "ResourceGuard.h"
#include "PropertyKeyConst.h"
#include "DebugAssertion.h"
#include "Debug.h"
#include "Logger.h"

using namespace std;
using namespace nacos;
Expand Down Expand Up @@ -182,7 +182,7 @@ int main() {
#include "listen/Listener.h"
#include "PropertyKeyConst.h"
#include "DebugAssertion.h"
#include "Debug.h"
#include "Logger.h"

using namespace std;
using namespace nacos;
Expand Down Expand Up @@ -241,7 +241,7 @@ int main() {
#include "utils/UtilAndComs.h"
#include "http/HTTPCli.h"
#include "DebugAssertion.h"
#include "Debug.h"
#include "Logger.h"
#include "NacosString.h"
#include "Properties.h"
#include "PropertyKeyConst.h"
Expand Down Expand Up @@ -305,7 +305,7 @@ int main() {
#include "naming/subscribe/EventListener.h"
#include "PropertyKeyConst.h"
#include "DebugAssertion.h"
#include "Debug.h"
#include "Logger.h"

using namespace std;
using namespace nacos;
Expand All @@ -332,7 +332,7 @@ int main() {
props[PropertyKeyConst::SERVER_ADDR] = "127.0.0.1:8848";
//Interval for poller to check the status of subscribed services(unit:Ms), 30000 by default
//Here we set it to 5000 to see the output more quick
props[PropertyKeyConst::TCP_NAMING_POLL_INTERVAL] = "5000";
props[PropertyKeyConst::SUBSCRIPTION_POLL_INTERVAL] = "5000";
NacosServiceFactory *factory = new NacosServiceFactory(props);
ResourceGuard <NacosServiceFactory> _guardFactory(factory);
NamingService *n = factory->CreateNamingService();
Expand Down Expand Up @@ -370,7 +370,7 @@ int main() {
#include "utils/UtilAndComs.h"
#include "http/HTTPCli.h"
#include "DebugAssertion.h"
#include "Debug.h"
#include "Logger.h"
#include "NacosString.h"
#include "Properties.h"
#include "PropertyKeyConst.h"
Expand Down
132 changes: 0 additions & 132 deletions include/Constants.h

This file was deleted.

55 changes: 0 additions & 55 deletions include/Debug.h

This file was deleted.

9 changes: 5 additions & 4 deletions include/DebugAssertion.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ifndef _ALL_IN_ONE_H_
#define _ALL_IN_ONE_H_
#ifndef __DEBUG_ASSERTION_H_
#define __DEBUG_ASSERTION_H_

#include <stdlib.h>
#include <stdio.h>
#include "NacosString.h"
#include "Debug.h"
#include "src/log/Logger.h"

namespace nacos{
#define TEST_ITEM_START {
Expand All @@ -13,7 +14,7 @@ namespace nacos{
#define NACOS_ASSERT(x) \
if (!(x)) \
{ \
log_error("Assertion failed! file:" __FILE__":%d\n", __LINE__); \
printf("Assertion failed! file:" __FILE__":%d\n", __LINE__); \
abort(); \
}

Expand Down
7 changes: 5 additions & 2 deletions include/NacosExceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ class NacosException : public std::exception {
static const int NO_SERVER_AVAILABLE = 1005;
static const int INVALID_LOGIN_CREDENTIAL = 1006;
static const int UNABLE_TO_OPEN_FILE = 1007;
static const int UNABLE_TO_GET_HOST_IP = 1008;
static const int UNABLE_TO_CREATE_SOCKET = 1009;
static const int INVALID_CONFIG_PARAM = 1010;

};

Expand Down Expand Up @@ -107,8 +110,8 @@ class IOException : public NacosException {

class MalformedConfigException : public NacosException {
public:
MalformedConfigException(const NacosString &file) : NacosException(NacosException::MALFORMED_CONFIG_FILE,
"Malformed Config file:" + file) {};
MalformedConfigException(const NacosString &file, const NacosString &detailedMsg) : NacosException(NacosException::MALFORMED_CONFIG_FILE,
"Malformed Config file:" + file + " reason:" + detailedMsg) {};
};

class InvalidFactoryConfigException : public NacosException {
Expand Down
2 changes: 1 addition & 1 deletion include/ResourceGuard.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef NACOS_SDK_CPP_RESOURCEGUARD_H
#define NACOS_SDK_CPP_RESOURCEGUARD_H

#include "Debug.h"
#include "src/log/Logger.h"

namespace nacos{
template<typename T>
Expand Down
Loading

0 comments on commit c29099a

Please sign in to comment.