Commit 04b3df2e authored by 段英荣's avatar 段英荣

Initial commit

parents
.settings
.cproject
.project
.git
Debug
# Copyright 2018 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# cmake build file for C++ helloworld example.
# Assumes protobuf and gRPC have been installed using cmake.
# See cmake_externalproject/CMakeLists.txt for all-in-one cmake build
# that automatically builds all the dependencies before building helloworld.
cmake_minimum_required(VERSION 3.5.1)
project(HelloWorld C CXX)
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
add_definitions(-D_WIN32_WINNT=0x600)
endif()
find_package(Threads REQUIRED)
if(GRPC_AS_SUBMODULE)
# One way to build a projects that uses gRPC is to just include the
# entire gRPC project tree via "add_subdirectory".
# This approach is very simple to use, but the are some potential
# disadvantages:
# * it includes gRPC's CMakeLists.txt directly into your build script
# without and that can make gRPC's internal setting interfere with your
# own build.
# * depending on what's installed on your system, the contents of submodules
# in gRPC's third_party/* might need to be available (and there might be
# additional prerequisites required to build them). Consider using
# the gRPC_*_PROVIDER options to fine-tune the expected behavior.
#
# A more robust approach to add dependency on gRPC is using
# cmake's ExternalProject_Add (see cmake_externalproject/CMakeLists.txt).
# Include the gRPC's cmake build (normally grpc source code would live
# in a git submodule called "third_party/grpc", but this example lives in
# the same repository as gRPC sources, so we just look a few directories up)
add_subdirectory(../../.. ${CMAKE_CURRENT_BINARY_DIR}/grpc EXCLUDE_FROM_ALL)
message(STATUS "Using gRPC via add_subdirectory.")
# After using add_subdirectory, we can now use the grpc targets directly from
# this build.
set(_PROTOBUF_LIBPROTOBUF libprotobuf)
set(_REFLECTION grpc++_reflection)
if(CMAKE_CROSSCOMPILING)
find_program(_PROTOBUF_PROTOC protoc)
else()
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
endif()
set(_GRPC_GRPCPP grpc++)
if(CMAKE_CROSSCOMPILING)
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
else()
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:grpc_cpp_plugin>)
endif()
elseif(GRPC_FETCHCONTENT)
# Another way is to use CMake's FetchContent module to clone gRPC at
# configure time. This makes gRPC's source code available to your project,
# similar to a git submodule.
message(STATUS "Using gRPC via add_subdirectory (FetchContent).")
include(FetchContent)
FetchContent_Declare(
grpc
GIT_REPOSITORY https://github.com/grpc/grpc.git
# when using gRPC, you will actually set this to an existing tag, such as
# v1.25.0, v1.26.0 etc..
# For the purpose of testing, we override the tag used to the commit
# that's currently under test.
GIT_TAG vGRPC_TAG_VERSION_OF_YOUR_CHOICE)
FetchContent_MakeAvailable(grpc)
# Since FetchContent uses add_subdirectory under the hood, we can use
# the grpc targets directly from this build.
set(_PROTOBUF_LIBPROTOBUF libprotobuf)
set(_REFLECTION grpc++_reflection)
set(_PROTOBUF_PROTOC $<TARGET_FILE:protoc>)
set(_GRPC_GRPCPP grpc++)
if(CMAKE_CROSSCOMPILING)
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
else()
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:grpc_cpp_plugin>)
endif()
else()
# This branch assumes that gRPC and all its dependencies are already installed
# on this system, so they can be located by find_package().
# Find Protobuf installation
# Looks for protobuf-config.cmake file installed by Protobuf's cmake installation.
set(protobuf_MODULE_COMPATIBLE TRUE)
find_package(Protobuf CONFIG REQUIRED)
message(STATUS "Using protobuf ${Protobuf_VERSION}")
set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf)
set(_REFLECTION gRPC::grpc++_reflection)
if(CMAKE_CROSSCOMPILING)
find_program(_PROTOBUF_PROTOC protoc)
else()
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
endif()
# Find gRPC installation
# Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.
find_package(gRPC CONFIG REQUIRED)
message(STATUS "Using gRPC ${gRPC_VERSION}")
set(_GRPC_GRPCPP gRPC::grpc++)
find_package(PkgConfig)
pkg_search_module(_REDISLIB REQUIRED hiredis)
find_package(Poco CONFIG REQUIRED Util Data Net XML Zip)
message(STATUS "Using Poco ${Poco_VERSION}")
if(CMAKE_CROSSCOMPILING)
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
else()
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
endif()
endif()
# Proto file
get_filename_component(query_analyzer_proto "/Users/gengmei/eclipse-workspace/CppTensor/pb/query_analyzer.proto" ABSOLUTE)
get_filename_component(query_analyzer_proto_path "${query_analyzer_proto}" PATH)
# Generated sources
set(query_analyzer_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/query_analyzer.pb.cc")
set(query_analyzer_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/query_analyzer.pb.h")
set(query_analyzer_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/query_analyzer.grpc.pb.cc")
set(query_analyzer_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/query_analyzer.grpc.pb.h")
add_custom_command(
OUTPUT "${query_analyzer_proto_srcs}" "${query_analyzer_proto_hdrs}" "${query_analyzer_grpc_srcs}" "${query_analyzer_grpc_hdrs}"
COMMAND ${_PROTOBUF_PROTOC}
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
-I "${query_analyzer_proto_path}"
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
"${query_analyzer_proto}"
DEPENDS "${query_analyzer_proto}")
# Include generated *.pb.h files
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../../redis")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../../app/config")
file(GLOB SRCS "app/*.cpp")
file(GLOB CONFIG_SRCS "app/config/*.cpp")
file(GLOB REDIS_SRCS "redis/*.cpp")
# Targets greeter_[async_](client|server)
foreach(_target strategy_server)
add_executable(${_target} ${SRCS} ${CONFIG_SRCS} ${REDIS_SRCS}
${query_analyzer_proto_srcs}
${query_analyzer_grpc_srcs})
target_link_libraries(${_target}
${_REFLECTION}
${_GRPC_GRPCPP}
${_PROTOBUF_LIBPROTOBUF}
${Poco_LIBRARIES}
${_REDISLIB_LIBRARIES})
endforeach()
#include "server_config.h"
ServerConfig* ServerConfig::_conf = NULL;
ServerConfig::ServerConfig()
{
_bIsLoad = false;
}
ServerConfig::~ServerConfig()
{}
void ServerConfig::LoadConfig(AbstractConfiguration &config)
{
if ( false == _bIsLoad )
{
_settings._port = config.getInt("port");
_settings._max_thread = config.getInt("max_threads");
_settings._max_queue = config.getInt("max_queued");
_settings._thread_idle_time = config.getInt("thread_idle_time");
_settings._log_path = config.getString("log_path");
_settings._redisServerIp = config.getString("redis_server_ip");
_settings._redisAuth = config.getString("redis_auth");
_settings._redisNeedAuth = config.getInt("redis_need_auth");
_settings._redisServerPort = config.getInt("redis_server_port");
_settings._redisConTimeOut = config.getInt("redis_con_timeout");
_settings._connRetryTimes = config.getInt("redis_connect_retry_times");
_settings._iMaxThreadNum = config.getInt("instance_max_threads_num");
_settings._iDefThreadNum = config.getInt("instance_default_threads_num");
_settings._iServerFlag = config.getInt("server_flag");
_bIsLoad = true;
}
}
LocalSettings ServerConfig::getLocalSettings()
{
return _settings;
}
ServerConfig* ServerConfig::getInstance()
{
if ( NULL == _conf )
_conf = new ServerConfig();
return _conf;
}
#ifndef _SERVER_CONFIG_INCLUDE
#define _SERVER_CONFIG_INCLUDE
#include <string>
#include <Poco/Util/Application.h>
#include "Poco/Util/ServerApplication.h"
using Poco::Util::ServerApplication;
//using namespace Poco::Net;
using namespace Poco::Util;
using namespace std;
struct LocalSettings
{
int _max_thread;
int _max_queue;
int _thread_idle_time;
string _log_path;
string _redisServerIp;
string _redisAuth;
int _redisNeedAuth;
int _redisServerPort;
int _redisConTimeOut;
int _port;
int _connRetryTimes;
int _iMaxThreadNum;
int _iDefThreadNum;
int _iServerFlag;
inline int getMaxTrd()
{
return _max_thread;
}
inline int getMaxQue()
{
return _max_queue;
}
inline int getIdleTime()
{
return _thread_idle_time;
}
inline string getLogPath()
{
return _log_path;
}
};
class ServerConfig
{
public:
ServerConfig();
~ServerConfig();
void LoadConfig(AbstractConfiguration &config);
LocalSettings getLocalSettings();
static ServerConfig* getInstance();
private:
static ServerConfig *_conf;
LocalSettings _settings;
bool _bIsLoad;
};
#endif
#include <Poco/Format.h>
#include "Poco/Exception.h"
#include "query_analyzer.h"
#include "Poco/JSON/Object.h"
#include "Poco/JSON/Parser.h"
#include "Poco/JSON/Query.h"
#include "Poco/JSON/JSONException.h"
#include "Poco/JSON/Stringifier.h"
#include "Poco/JSON/ParseHandler.h"
#include "Poco/JSON/PrintHandler.h"
#include "Poco/JSON/Template.h"
#include "Poco/JSON/JSONException.h"
#include "Poco/JSON/ParseHandler.h"
#include "Poco/Dynamic/Var.h"
using namespace std;
using namespace Poco::JSON;
using Poco::JSON::Parser;
using Poco::JSON::Object;
using namespace Poco::Dynamic;
using Poco::Dynamic::Var;
QueryAnalyzerImpl::QueryAnalyzerImpl()
:_logger(Logger::get("StrategyServer")){
_pRedis = RedisManage::getInstance();
}
Status QueryAnalyzerImpl::QueryInferenceService(ServerContext* context,const QueryInferenceRequest *request,QueryInferenceReply *reply){
std::map<std::string,int> query_flag_map = {
{"unknown", 0}, //未知
{"face", 1}, //魔镜
{"free_face", 2}, //免费整形
{"hospital", 3}, //医院
{"doctor", 4}, //医生
{"project", 5}, //项目
};
try {
std::string query_word = request->query();
std::string version_type = request->version_type();
bool return_face = request->return_face();
int iredisDuration = 0;
redisContext *pContext = NULL;
_pRedis->getRedisContext(&pContext);
int iRetLabel = query_flag_map["unknown"];
std::string stValue;
std::string stCommand = "get " + query_word;
if(_pRedis->get(stCommand, stValue,pContext,&iredisDuration)){
Parser parser;
Var result = parser.parse(stValue);
Object::Ptr pObjPtr = result.extract<JSON::Object::Ptr>();
iRetLabel = atoi(pObjPtr->get(std::string("value")).toString().c_str());
int is_online = atoi((pObjPtr->get(std::string("is_online"))).toString().c_str());
}
reply->set_label(iRetLabel);
return Status::OK;
} catch (Poco::Exception e) {
_logger.error(Poco::format("Exception occured in func %s,err_msg is:%s",string(__FUNCTION__),e.displayText()));
return Status::OK;
}
}
#ifndef _QUERY_ANALYZER_INCLUDE
#define _QUERY_ANALYZER_INCLUDE
#include <iostream>
#include <memory>
#include <string>
#include <Poco/Logger.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/health_check_service_interface.h>
#include <grpcpp/ext/proto_server_reflection_plugin.h>
#include "query_analyzer.grpc.pb.h"
#include "redis_manage.h"
using grpc::Server;
using grpc::ServerBuilder;
using grpc::ServerContext;
using grpc::Status;
using QueryAnalyzer::QueryInferenceService;
using QueryAnalyzer::QueryInferenceRequest;
using QueryAnalyzer::QueryInferenceReply;
using Poco::Logger;
class QueryAnalyzerImpl final : public QueryInferenceService::Service{
public:
QueryAnalyzerImpl();
Status QueryInferenceService(ServerContext* context,const QueryInferenceRequest *request,QueryInferenceReply *reply);
private:
RedisManage *_pRedis;
Logger &_logger;
};
#endif
#include <iostream>
#include <memory>
#include <string>
#include <Poco/Logger.h>
#include "Poco/FileChannel.h"
#include <Poco/FormattingChannel.h>
#include <Poco/PatternFormatter.h>
#include "query_analyzer.h"
#include "server_config.h"
using Poco::FormattingChannel;
using Poco::FileChannel;
using Poco::PatternFormatter;
using Poco::AutoPtr;
using Poco::Util::ServerApplication;
void init_config(AbstractConfiguration &config){
// get original launching path before daemonizing
std::string cwd(getenv("POCO_CWD"));
// init logging
ServerConfig* confIns = ServerConfig::getInstance();
confIns->LoadConfig(config);
AutoPtr<Poco::Channel> pFileChannel(new FileChannel);
std::string logPath = config.getString("log_path");
if (logPath[0] != '/')
logPath = cwd + "/" + logPath;
pFileChannel->setProperty("path", logPath);
pFileChannel->setProperty("rotation", "00:00");
pFileChannel->setProperty("archive", "timestamp");
pFileChannel->setProperty("times", "local");
pFileChannel->setProperty("purgeAge", "30 days");
AutoPtr<PatternFormatter> pPF(new PatternFormatter);
pPF->setProperty("times", "local");
pPF->setProperty("pattern", "[%Y-%m-%d %H:%M:%S] %P-%I %p: %t");
AutoPtr<FormattingChannel> pFC(new FormattingChannel(pPF, pFileChannel));
Poco::Logger::root().setChannel(pFC);
Poco::Logger& logger = Poco::Logger::get("StrategyServer"); // inherits root channel
}
void RunServer(AbstractConfiguration &config) {
std::string stHost = config.getString("host");
std::string stPort = config.getString("port");
std::string server_address(stHost + ":" + stPort);
QueryAnalyzerImpl service;
grpc::EnableDefaultHealthCheckService(true);
grpc::reflection::InitProtoReflectionServerBuilderPlugin();
ServerBuilder builder;
// Listen on the given address without any authentication mechanism.
builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
// Register "service" as the instance through which we'll communicate with
// clients. In this case it corresponds to an *synchronous* service.
builder.RegisterService(&service);
// Finally assemble the server.
std::unique_ptr<Server> server(builder.BuildAndStart());
std::cout << "Server listening on " << server_address << std::endl;
// Wait for the server to shutdown. Note that some other thread must be
// responsible for shutting down the server for this call to ever return.
server->Wait();
}
int main(int argc,char **argv){
AbstractConfiguration &config(Application::instance().config());
init_config(config);
RunServer(config);
return 1;
}
# Server Instance
#
host=172.16.44.82
port=50051
# Server Basic Properties
#
max_threads=50
max_queued=100
thread_idle_time=10
log_path=./log/
#max thread num for processing mask rule and export src
instance_max_threads_num=50
#default thread num for processing mask rule and export src
#on the other words,this is default hotel num for each thread function
instance_default_threads_num=2
#1 means needing password
redis_need_auth=1
redis_auth=ReDis!GmTx*0aN6
redis_server_ip=172.16.40.133
redis_server_port=6379
redis_con_timeout=50
redis_connect_retry_times=3
This diff is collapsed.
set(CMAKE_C_COMPILER "/Library/Developer/CommandLineTools/usr/bin/cc")
set(CMAKE_C_COMPILER_ARG1 "")
set(CMAKE_C_COMPILER_ID "AppleClang")
set(CMAKE_C_COMPILER_VERSION "10.0.0.10001044")
set(CMAKE_C_COMPILER_VERSION_INTERNAL "")
set(CMAKE_C_COMPILER_WRAPPER "")
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11")
set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert")
set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes")
set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros")
set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert")
set(CMAKE_C_PLATFORM_ID "Darwin")
set(CMAKE_C_SIMULATE_ID "")
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "")
set(CMAKE_C_SIMULATE_VERSION "")
set(CMAKE_AR "/Library/Developer/CommandLineTools/usr/bin/ar")
set(CMAKE_C_COMPILER_AR "")
set(CMAKE_RANLIB "/Library/Developer/CommandLineTools/usr/bin/ranlib")
set(CMAKE_C_COMPILER_RANLIB "")
set(CMAKE_LINKER "/Library/Developer/CommandLineTools/usr/bin/ld")
set(CMAKE_MT "")
set(CMAKE_COMPILER_IS_GNUCC )
set(CMAKE_C_COMPILER_LOADED 1)
set(CMAKE_C_COMPILER_WORKS TRUE)
set(CMAKE_C_ABI_COMPILED TRUE)
set(CMAKE_COMPILER_IS_MINGW )
set(CMAKE_COMPILER_IS_CYGWIN )
if(CMAKE_COMPILER_IS_CYGWIN)
set(CYGWIN 1)
set(UNIX 1)
endif()
set(CMAKE_C_COMPILER_ENV_VAR "CC")
if(CMAKE_COMPILER_IS_MINGW)
set(MINGW 1)
endif()
set(CMAKE_C_COMPILER_ID_RUN 1)
set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
set(CMAKE_C_LINKER_PREFERENCE 10)
# Save compiler ABI information.
set(CMAKE_C_SIZEOF_DATA_PTR "8")
set(CMAKE_C_COMPILER_ABI "")
set(CMAKE_C_LIBRARY_ARCHITECTURE "")
if(CMAKE_C_SIZEOF_DATA_PTR)
set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
endif()
if(CMAKE_C_COMPILER_ABI)
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
endif()
if(CMAKE_C_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "")
endif()
set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "")
if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
endif()
set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/local/include;/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/include;/Library/Developer/CommandLineTools/usr/include;/usr/include")
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "")
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib;/usr/local/lib")
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "/Library/Frameworks;/System/Library/Frameworks")
set(CMAKE_CXX_COMPILER "/Library/Developer/CommandLineTools/usr/bin/c++")
set(CMAKE_CXX_COMPILER_ARG1 "")
set(CMAKE_CXX_COMPILER_ID "AppleClang")
set(CMAKE_CXX_COMPILER_VERSION "10.0.0.10001044")
set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "")
set(CMAKE_CXX_COMPILER_WRAPPER "")
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "98")
set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20")
set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters")
set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates")
set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates")
set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17")
set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20")
set(CMAKE_CXX_PLATFORM_ID "Darwin")
set(CMAKE_CXX_SIMULATE_ID "")
set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "")
set(CMAKE_CXX_SIMULATE_VERSION "")
set(CMAKE_AR "/Library/Developer/CommandLineTools/usr/bin/ar")
set(CMAKE_CXX_COMPILER_AR "")
set(CMAKE_RANLIB "/Library/Developer/CommandLineTools/usr/bin/ranlib")
set(CMAKE_CXX_COMPILER_RANLIB "")
set(CMAKE_LINKER "/Library/Developer/CommandLineTools/usr/bin/ld")
set(CMAKE_MT "")
set(CMAKE_COMPILER_IS_GNUCXX )
set(CMAKE_CXX_COMPILER_LOADED 1)
set(CMAKE_CXX_COMPILER_WORKS TRUE)
set(CMAKE_CXX_ABI_COMPILED TRUE)
set(CMAKE_COMPILER_IS_MINGW )
set(CMAKE_COMPILER_IS_CYGWIN )
if(CMAKE_COMPILER_IS_CYGWIN)
set(CYGWIN 1)
set(UNIX 1)
endif()
set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
if(CMAKE_COMPILER_IS_MINGW)
set(MINGW 1)
endif()
set(CMAKE_CXX_COMPILER_ID_RUN 1)
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP)
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
foreach (lang C OBJC OBJCXX)
if (CMAKE_${lang}_COMPILER_ID_RUN)
foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS)
list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension})
endforeach()
endif()
endforeach()
set(CMAKE_CXX_LINKER_PREFERENCE 30)
set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
# Save compiler ABI information.
set(CMAKE_CXX_SIZEOF_DATA_PTR "8")
set(CMAKE_CXX_COMPILER_ABI "")
set(CMAKE_CXX_LIBRARY_ARCHITECTURE "")
if(CMAKE_CXX_SIZEOF_DATA_PTR)
set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
endif()
if(CMAKE_CXX_COMPILER_ABI)
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
endif()
if(CMAKE_CXX_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "")
endif()
set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "")
if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX)
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}")
endif()
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/Library/Developer/CommandLineTools/usr/include/c++/v1;/usr/local/include;/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/include;/Library/Developer/CommandLineTools/usr/include;/usr/include")
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "c++")
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib;/usr/local/lib")
set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "/Library/Frameworks;/System/Library/Frameworks")
set(CMAKE_HOST_SYSTEM "Darwin-17.7.0")
set(CMAKE_HOST_SYSTEM_NAME "Darwin")
set(CMAKE_HOST_SYSTEM_VERSION "17.7.0")
set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
set(CMAKE_SYSTEM "Darwin-17.7.0")
set(CMAKE_SYSTEM_NAME "Darwin")
set(CMAKE_SYSTEM_VERSION "17.7.0")
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(CMAKE_CROSSCOMPILING "FALSE")
set(CMAKE_SYSTEM_LOADED 1)
This diff is collapsed.
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.19
# Relative path conversion top directories.
set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/Users/gengmei/eclipse-workspace/CppTensor")
set(CMAKE_RELATIVE_PATH_TOP_BINARY "/Users/gengmei/eclipse-workspace/CppTensor/cmake/build")
# Force unix paths in dependencies.
set(CMAKE_FORCE_UNIX_PATHS 1)
# The C and CXX include file regular expressions for this directory.
set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})
This diff is collapsed.
# Hashes of file build rules.
e8ac620de8782d4ed484f180c153f54e query_analyzer.pb.cc
This diff is collapsed.
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.19
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Disable VCS-based implicit rules.
% : %,v
# Disable VCS-based implicit rules.
% : RCS/%
# Disable VCS-based implicit rules.
% : RCS/%,v
# Disable VCS-based implicit rules.
% : SCCS/s.%
# Disable VCS-based implicit rules.
% : s.%
.SUFFIXES: .hpux_make_needs_suffix_list
# Command-line flag to silence nested $(MAKE).
$(VERBOSE)MAKESILENT = -s
#Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /Applications/CMake.app/Contents/bin/cmake
# The command to remove a file.
RM = /Applications/CMake.app/Contents/bin/cmake -E rm -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/gengmei/eclipse-workspace/CppTensor
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/gengmei/eclipse-workspace/CppTensor/cmake/build
#=============================================================================
# Directory level rules for the build root directory
# The main recursive "all" target.
all: CMakeFiles/strategy_server.dir/all
.PHONY : all
# The main recursive "preinstall" target.
preinstall:
.PHONY : preinstall
# The main recursive "clean" target.
clean: CMakeFiles/strategy_server.dir/clean
.PHONY : clean
#=============================================================================
# Target rules for target CMakeFiles/strategy_server.dir
# All Build rule for target.
CMakeFiles/strategy_server.dir/all:
$(MAKE) $(MAKESILENT) -f CMakeFiles/strategy_server.dir/build.make CMakeFiles/strategy_server.dir/depend
$(MAKE) $(MAKESILENT) -f CMakeFiles/strategy_server.dir/build.make CMakeFiles/strategy_server.dir/build
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/CMakeFiles --progress-num=1,2,3,4,5,6,7,8 "Built target strategy_server"
.PHONY : CMakeFiles/strategy_server.dir/all
# Build rule for subdir invocation for target.
CMakeFiles/strategy_server.dir/rule: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /Users/gengmei/eclipse-workspace/CppTensor/cmake/build/CMakeFiles 8
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 CMakeFiles/strategy_server.dir/all
$(CMAKE_COMMAND) -E cmake_progress_start /Users/gengmei/eclipse-workspace/CppTensor/cmake/build/CMakeFiles 0
.PHONY : CMakeFiles/strategy_server.dir/rule
# Convenience name for target.
strategy_server: CMakeFiles/strategy_server.dir/rule
.PHONY : strategy_server
# clean rule for target.
CMakeFiles/strategy_server.dir/clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles/strategy_server.dir/build.make CMakeFiles/strategy_server.dir/clean
.PHONY : CMakeFiles/strategy_server.dir/clean
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/CMakeFiles/rebuild_cache.dir
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/CMakeFiles/edit_cache.dir
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/CMakeFiles/strategy_server.dir
# This file is generated by cmake for dependency checking of the CMakeCache.txt file
#IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">])
#IncludeRegexScan: ^.*$
#IncludeRegexComplain: ^$
#IncludeRegexTransform:
../../app/config/server_config.h
string
-
Poco/Util/Application.h
-
Poco/Util/ServerApplication.h
../../app/config/Poco/Util/ServerApplication.h
../../redis/redis_manage.h
iostream
-
sstream
-
Poco/Logger.h
-
server_config.h
../../redis/server_config.h
hiredis/hiredis.h
../../redis/hiredis/hiredis.h
Poco/zlib.h
-
stdlib.h
../../redis/stdlib.h
/Users/gengmei/eclipse-workspace/CppTensor/app/config/server_config.cpp
server_config.h
/Users/gengmei/eclipse-workspace/CppTensor/app/config/server_config.h
/Users/gengmei/eclipse-workspace/CppTensor/app/config/server_config.h
string
-
Poco/Util/Application.h
-
Poco/Util/ServerApplication.h
/Users/gengmei/eclipse-workspace/CppTensor/app/config/Poco/Util/ServerApplication.h
/Users/gengmei/eclipse-workspace/CppTensor/app/query_analyzer.cpp
Poco/Format.h
-
Poco/Exception.h
/Users/gengmei/eclipse-workspace/CppTensor/app/Poco/Exception.h
query_analyzer.h
/Users/gengmei/eclipse-workspace/CppTensor/app/query_analyzer.h
Poco/JSON/Object.h
/Users/gengmei/eclipse-workspace/CppTensor/app/Poco/JSON/Object.h
Poco/JSON/Parser.h
/Users/gengmei/eclipse-workspace/CppTensor/app/Poco/JSON/Parser.h
Poco/JSON/Query.h
/Users/gengmei/eclipse-workspace/CppTensor/app/Poco/JSON/Query.h
Poco/JSON/JSONException.h
/Users/gengmei/eclipse-workspace/CppTensor/app/Poco/JSON/JSONException.h
Poco/JSON/Stringifier.h
/Users/gengmei/eclipse-workspace/CppTensor/app/Poco/JSON/Stringifier.h
Poco/JSON/ParseHandler.h
/Users/gengmei/eclipse-workspace/CppTensor/app/Poco/JSON/ParseHandler.h
Poco/JSON/PrintHandler.h
/Users/gengmei/eclipse-workspace/CppTensor/app/Poco/JSON/PrintHandler.h
Poco/JSON/Template.h
/Users/gengmei/eclipse-workspace/CppTensor/app/Poco/JSON/Template.h
Poco/JSON/JSONException.h
/Users/gengmei/eclipse-workspace/CppTensor/app/Poco/JSON/JSONException.h
Poco/JSON/ParseHandler.h
/Users/gengmei/eclipse-workspace/CppTensor/app/Poco/JSON/ParseHandler.h
Poco/Dynamic/Var.h
/Users/gengmei/eclipse-workspace/CppTensor/app/Poco/Dynamic/Var.h
/Users/gengmei/eclipse-workspace/CppTensor/app/query_analyzer.h
iostream
-
memory
-
string
-
Poco/Logger.h
-
grpcpp/grpcpp.h
-
grpcpp/health_check_service_interface.h
-
grpcpp/ext/proto_server_reflection_plugin.h
-
query_analyzer.grpc.pb.h
/Users/gengmei/eclipse-workspace/CppTensor/app/query_analyzer.grpc.pb.h
redis_manage.h
/Users/gengmei/eclipse-workspace/CppTensor/app/redis_manage.h
/Users/gengmei/eclipse-workspace/CppTensor/app/rpc_handle.cpp
iostream
-
memory
-
string
-
Poco/Logger.h
-
Poco/FileChannel.h
/Users/gengmei/eclipse-workspace/CppTensor/app/Poco/FileChannel.h
Poco/FormattingChannel.h
-
Poco/PatternFormatter.h
-
query_analyzer.h
/Users/gengmei/eclipse-workspace/CppTensor/app/query_analyzer.h
server_config.h
/Users/gengmei/eclipse-workspace/CppTensor/app/server_config.h
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.grpc.pb.cc
query_analyzer.pb.h
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.pb.h
query_analyzer.grpc.pb.h
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.grpc.pb.h
functional
-
grpcpp/impl/codegen/async_stream.h
-
grpcpp/impl/codegen/async_unary_call.h
-
grpcpp/impl/codegen/channel_interface.h
-
grpcpp/impl/codegen/client_unary_call.h
-
grpcpp/impl/codegen/client_callback.h
-
grpcpp/impl/codegen/message_allocator.h
-
grpcpp/impl/codegen/method_handler.h
-
grpcpp/impl/codegen/rpc_service_method.h
-
grpcpp/impl/codegen/server_callback.h
-
grpcpp/impl/codegen/server_callback_handlers.h
-
grpcpp/impl/codegen/server_context.h
-
grpcpp/impl/codegen/service_type.h
-
grpcpp/impl/codegen/sync_stream.h
-
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.grpc.pb.h
query_analyzer.pb.h
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.pb.h
functional
-
grpc/impl/codegen/port_platform.h
-
grpcpp/impl/codegen/async_generic_service.h
-
grpcpp/impl/codegen/async_stream.h
-
grpcpp/impl/codegen/async_unary_call.h
-
grpcpp/impl/codegen/client_callback.h
-
grpcpp/impl/codegen/client_context.h
-
grpcpp/impl/codegen/completion_queue.h
-
grpcpp/impl/codegen/message_allocator.h
-
grpcpp/impl/codegen/method_handler.h
-
grpcpp/impl/codegen/proto_utils.h
-
grpcpp/impl/codegen/rpc_method.h
-
grpcpp/impl/codegen/server_callback.h
-
grpcpp/impl/codegen/server_callback_handlers.h
-
grpcpp/impl/codegen/server_context.h
-
grpcpp/impl/codegen/service_type.h
-
grpcpp/impl/codegen/status.h
-
grpcpp/impl/codegen/stub_options.h
-
grpcpp/impl/codegen/sync_stream.h
-
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.pb.cc
query_analyzer.pb.h
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.pb.h
algorithm
-
google/protobuf/io/coded_stream.h
-
google/protobuf/extension_set.h
-
google/protobuf/wire_format_lite.h
-
google/protobuf/descriptor.h
-
google/protobuf/generated_message_reflection.h
-
google/protobuf/reflection_ops.h
-
google/protobuf/wire_format.h
-
google/protobuf/port_def.inc
-
google/protobuf/port_undef.inc
-
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.pb.h
limits
-
string
-
google/protobuf/port_def.inc
-
google/protobuf/port_undef.inc
-
google/protobuf/io/coded_stream.h
-
google/protobuf/arena.h
-
google/protobuf/arenastring.h
-
google/protobuf/generated_message_table_driven.h
-
google/protobuf/generated_message_util.h
-
google/protobuf/inlined_string_field.h
-
google/protobuf/metadata_lite.h
-
google/protobuf/generated_message_reflection.h
-
google/protobuf/message.h
-
google/protobuf/repeated_field.h
-
google/protobuf/extension_set.h
-
google/protobuf/unknown_field_set.h
-
google/protobuf/port_def.inc
-
google/protobuf/port_undef.inc
-
/Users/gengmei/eclipse-workspace/CppTensor/redis/redis_manage.cpp
redis_manage.h
/Users/gengmei/eclipse-workspace/CppTensor/redis/redis_manage.h
string.h
-
strings.h
-
Poco/Stopwatch.h
-
/Users/gengmei/eclipse-workspace/CppTensor/redis/redis_manage.h
iostream
-
sstream
-
Poco/Logger.h
-
server_config.h
/Users/gengmei/eclipse-workspace/CppTensor/redis/server_config.h
hiredis/hiredis.h
/Users/gengmei/eclipse-workspace/CppTensor/redis/hiredis/hiredis.h
Poco/zlib.h
-
stdlib.h
/Users/gengmei/eclipse-workspace/CppTensor/redis/stdlib.h
query_analyzer.grpc.pb.h
query_analyzer.pb.h
query_analyzer.pb.h
functional
-
grpc/impl/codegen/port_platform.h
-
grpcpp/impl/codegen/async_generic_service.h
-
grpcpp/impl/codegen/async_stream.h
-
grpcpp/impl/codegen/async_unary_call.h
-
grpcpp/impl/codegen/client_callback.h
-
grpcpp/impl/codegen/client_context.h
-
grpcpp/impl/codegen/completion_queue.h
-
grpcpp/impl/codegen/message_allocator.h
-
grpcpp/impl/codegen/method_handler.h
-
grpcpp/impl/codegen/proto_utils.h
-
grpcpp/impl/codegen/rpc_method.h
-
grpcpp/impl/codegen/server_callback.h
-
grpcpp/impl/codegen/server_callback_handlers.h
-
grpcpp/impl/codegen/server_context.h
-
grpcpp/impl/codegen/service_type.h
-
grpcpp/impl/codegen/status.h
-
grpcpp/impl/codegen/stub_options.h
-
grpcpp/impl/codegen/sync_stream.h
-
query_analyzer.pb.h
limits
-
string
-
google/protobuf/port_def.inc
-
google/protobuf/port_undef.inc
-
google/protobuf/io/coded_stream.h
-
google/protobuf/arena.h
-
google/protobuf/arenastring.h
-
google/protobuf/generated_message_table_driven.h
-
google/protobuf/generated_message_util.h
-
google/protobuf/inlined_string_field.h
-
google/protobuf/metadata_lite.h
-
google/protobuf/generated_message_reflection.h
-
google/protobuf/message.h
-
google/protobuf/repeated_field.h
-
google/protobuf/extension_set.h
-
google/protobuf/unknown_field_set.h
-
google/protobuf/port_def.inc
-
google/protobuf/port_undef.inc
-
# The set of languages for which implicit dependencies are needed:
set(CMAKE_DEPENDS_LANGUAGES
"CXX"
)
# The set of files for implicit dependencies of each language:
set(CMAKE_DEPENDS_CHECK_CXX
"/Users/gengmei/eclipse-workspace/CppTensor/app/config/server_config.cpp" "/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/CMakeFiles/strategy_server.dir/app/config/server_config.cpp.o"
"/Users/gengmei/eclipse-workspace/CppTensor/app/query_analyzer.cpp" "/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/CMakeFiles/strategy_server.dir/app/query_analyzer.cpp.o"
"/Users/gengmei/eclipse-workspace/CppTensor/app/rpc_handle.cpp" "/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/CMakeFiles/strategy_server.dir/app/rpc_handle.cpp.o"
"/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.grpc.pb.cc" "/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/CMakeFiles/strategy_server.dir/query_analyzer.grpc.pb.cc.o"
"/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.pb.cc" "/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/CMakeFiles/strategy_server.dir/query_analyzer.pb.cc.o"
"/Users/gengmei/eclipse-workspace/CppTensor/redis/redis_manage.cpp" "/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/CMakeFiles/strategy_server.dir/redis/redis_manage.cpp.o"
)
set(CMAKE_CXX_COMPILER_ID "AppleClang")
# Preprocessor definitions for this target.
set(CMAKE_TARGET_DEFINITIONS_CXX
"CARES_STATICLIB"
"POCO_ENABLE_CPP11"
"POCO_ENABLE_CPP14"
"POCO_HAVE_IPv6"
"POCO_NO_STAT64"
"POCO_OS_FAMILY_UNIX"
"XML_DTD"
)
# The include file search paths:
set(CMAKE_CXX_TARGET_INCLUDE_PATH
"."
"../../redis"
"../../app/config"
)
# Pairs of files generated by the same build rule.
set(CMAKE_MULTIPLE_OUTPUT_PAIRS
"/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.grpc.pb.cc" "/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.pb.cc"
"/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.grpc.pb.h" "/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.pb.cc"
"/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.pb.h" "/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.pb.cc"
)
# Targets to which this target links.
set(CMAKE_TARGET_LINKED_INFO_FILES
)
# Fortran module output directory.
set(CMAKE_Fortran_TARGET_MODULE_DIR "")
This diff is collapsed.
file(REMOVE_RECURSE
"CMakeFiles/strategy_server.dir/app/config/server_config.cpp.o"
"CMakeFiles/strategy_server.dir/app/query_analyzer.cpp.o"
"CMakeFiles/strategy_server.dir/app/rpc_handle.cpp.o"
"CMakeFiles/strategy_server.dir/query_analyzer.grpc.pb.cc.o"
"CMakeFiles/strategy_server.dir/query_analyzer.pb.cc.o"
"CMakeFiles/strategy_server.dir/redis/redis_manage.cpp.o"
"query_analyzer.grpc.pb.cc"
"query_analyzer.grpc.pb.h"
"query_analyzer.pb.cc"
"query_analyzer.pb.h"
"strategy_server"
"strategy_server.pdb"
)
# Per-language clean rules from dependency scanning.
foreach(lang CXX)
include(CMakeFiles/strategy_server.dir/cmake_clean_${lang}.cmake OPTIONAL)
endforeach()
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.19
CMakeFiles/strategy_server.dir/app/config/server_config.cpp.o
/Users/gengmei/eclipse-workspace/CppTensor/app/config/server_config.cpp
/Users/gengmei/eclipse-workspace/CppTensor/app/config/server_config.h
CMakeFiles/strategy_server.dir/app/query_analyzer.cpp.o
../../app/config/server_config.h
../../redis/redis_manage.h
/Users/gengmei/eclipse-workspace/CppTensor/app/query_analyzer.cpp
/Users/gengmei/eclipse-workspace/CppTensor/app/query_analyzer.h
query_analyzer.grpc.pb.h
query_analyzer.pb.h
CMakeFiles/strategy_server.dir/app/rpc_handle.cpp.o
../../app/config/server_config.h
../../redis/redis_manage.h
/Users/gengmei/eclipse-workspace/CppTensor/app/query_analyzer.h
/Users/gengmei/eclipse-workspace/CppTensor/app/rpc_handle.cpp
query_analyzer.grpc.pb.h
query_analyzer.pb.h
CMakeFiles/strategy_server.dir/query_analyzer.grpc.pb.cc.o
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.grpc.pb.cc
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.grpc.pb.h
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.pb.h
CMakeFiles/strategy_server.dir/query_analyzer.pb.cc.o
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.pb.cc
/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/query_analyzer.pb.h
CMakeFiles/strategy_server.dir/redis/redis_manage.cpp.o
../../app/config/server_config.h
/Users/gengmei/eclipse-workspace/CppTensor/redis/redis_manage.cpp
/Users/gengmei/eclipse-workspace/CppTensor/redis/redis_manage.h
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.19
CMakeFiles/strategy_server.dir/app/config/server_config.cpp.o: ../../app/config/server_config.cpp
CMakeFiles/strategy_server.dir/app/config/server_config.cpp.o: ../../app/config/server_config.h
CMakeFiles/strategy_server.dir/app/query_analyzer.cpp.o: ../../app/config/server_config.h
CMakeFiles/strategy_server.dir/app/query_analyzer.cpp.o: ../../redis/redis_manage.h
CMakeFiles/strategy_server.dir/app/query_analyzer.cpp.o: ../../app/query_analyzer.cpp
CMakeFiles/strategy_server.dir/app/query_analyzer.cpp.o: ../../app/query_analyzer.h
CMakeFiles/strategy_server.dir/app/query_analyzer.cpp.o: query_analyzer.grpc.pb.h
CMakeFiles/strategy_server.dir/app/query_analyzer.cpp.o: query_analyzer.pb.h
CMakeFiles/strategy_server.dir/app/rpc_handle.cpp.o: ../../app/config/server_config.h
CMakeFiles/strategy_server.dir/app/rpc_handle.cpp.o: ../../redis/redis_manage.h
CMakeFiles/strategy_server.dir/app/rpc_handle.cpp.o: ../../app/query_analyzer.h
CMakeFiles/strategy_server.dir/app/rpc_handle.cpp.o: ../../app/rpc_handle.cpp
CMakeFiles/strategy_server.dir/app/rpc_handle.cpp.o: query_analyzer.grpc.pb.h
CMakeFiles/strategy_server.dir/app/rpc_handle.cpp.o: query_analyzer.pb.h
CMakeFiles/strategy_server.dir/query_analyzer.grpc.pb.cc.o: query_analyzer.grpc.pb.cc
CMakeFiles/strategy_server.dir/query_analyzer.grpc.pb.cc.o: query_analyzer.grpc.pb.h
CMakeFiles/strategy_server.dir/query_analyzer.grpc.pb.cc.o: query_analyzer.pb.h
CMakeFiles/strategy_server.dir/query_analyzer.pb.cc.o: query_analyzer.pb.cc
CMakeFiles/strategy_server.dir/query_analyzer.pb.cc.o: query_analyzer.pb.h
CMakeFiles/strategy_server.dir/redis/redis_manage.cpp.o: ../../app/config/server_config.h
CMakeFiles/strategy_server.dir/redis/redis_manage.cpp.o: ../../redis/redis_manage.cpp
CMakeFiles/strategy_server.dir/redis/redis_manage.cpp.o: ../../redis/redis_manage.h
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.19
# compile CXX with /Library/Developer/CommandLineTools/usr/bin/c++
CXX_DEFINES = -DCARES_STATICLIB -DPOCO_ENABLE_CPP11 -DPOCO_ENABLE_CPP14 -DPOCO_HAVE_IPv6 -DPOCO_NO_STAT64 -DPOCO_OS_FAMILY_UNIX -DXML_DTD
CXX_INCLUDES = -I/Users/gengmei/eclipse-workspace/CppTensor/cmake/build -I/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/../../redis -I/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/../../app/config
CXX_FLAGS = -std=c++11 -std=gnu++14
/Library/Developer/CommandLineTools/usr/bin/c++ -std=c++11 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/strategy_server.dir/app/query_analyzer.cpp.o CMakeFiles/strategy_server.dir/app/rpc_handle.cpp.o CMakeFiles/strategy_server.dir/app/config/server_config.cpp.o CMakeFiles/strategy_server.dir/redis/redis_manage.cpp.o CMakeFiles/strategy_server.dir/query_analyzer.pb.cc.o CMakeFiles/strategy_server.dir/query_analyzer.grpc.pb.cc.o -o strategy_server /usr/local/lib/libgrpc++_reflection.a /usr/local/lib/libgrpc++.a /usr/local/lib/libprotobuf.a /usr/local/lib/libPocoData.71.dylib /usr/local/lib/libPocoNet.71.dylib /usr/local/lib/libPocoZip.71.dylib -lhiredis /usr/local/lib/libgrpc.a /usr/local/lib/libssl.a /usr/local/lib/libcrypto.a /usr/local/lib/libz.a /usr/local/lib/libcares.a -lresolv /usr/local/lib/libre2.a /usr/local/lib/libabsl_statusor.a /usr/local/lib/libabsl_hash.a /usr/local/lib/libabsl_bad_variant_access.a /usr/local/lib/libabsl_city.a /usr/local/lib/libabsl_raw_hash_set.a /usr/local/lib/libabsl_hashtablez_sampler.a /usr/local/lib/libabsl_exponential_biased.a -framework CoreFoundation /usr/local/lib/libgpr.a /usr/local/lib/libabsl_status.a /usr/local/lib/libabsl_cord.a /usr/local/lib/libabsl_bad_optional_access.a /usr/local/lib/libabsl_synchronization.a /usr/local/lib/libabsl_stacktrace.a /usr/local/lib/libabsl_symbolize.a /usr/local/lib/libabsl_debugging_internal.a /usr/local/lib/libabsl_demangle_internal.a /usr/local/lib/libabsl_graphcycles_internal.a /usr/local/lib/libabsl_time.a /usr/local/lib/libabsl_civil_time.a /usr/local/lib/libabsl_time_zone.a -framework CoreFoundation /usr/local/lib/libabsl_malloc_internal.a /usr/local/lib/libabsl_str_format_internal.a /usr/local/lib/libabsl_strings.a /usr/local/lib/libabsl_strings_internal.a /usr/local/lib/libabsl_int128.a /usr/local/lib/libabsl_throw_delegate.a /usr/local/lib/libabsl_base.a /usr/local/lib/libabsl_raw_logging_internal.a /usr/local/lib/libabsl_log_severity.a /usr/local/lib/libabsl_spinlock_wait.a /usr/local/lib/libaddress_sorting.a /usr/local/lib/libupb.a -lm -lpthread /usr/local/lib/libPocoUtil.71.dylib /usr/local/lib/libPocoJSON.71.dylib /usr/local/lib/libPocoXML.71.dylib /usr/local/lib/libPocoFoundation.71.dylib
CMAKE_PROGRESS_1 = 1
CMAKE_PROGRESS_2 = 2
CMAKE_PROGRESS_3 = 3
CMAKE_PROGRESS_4 = 4
CMAKE_PROGRESS_5 = 5
CMAKE_PROGRESS_6 = 6
CMAKE_PROGRESS_7 = 7
CMAKE_PROGRESS_8 = 8
This diff is collapsed.
# Install script for directory: /Users/gengmei/eclipse-workspace/CppTensor
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()
# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()
# Is this installation the result of a crosscompile?
if(NOT DEFINED CMAKE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING "FALSE")
endif()
# Set default install directory permissions.
if(NOT DEFINED CMAKE_OBJDUMP)
set(CMAKE_OBJDUMP "/Library/Developer/CommandLineTools/usr/bin/objdump")
endif()
if(CMAKE_INSTALL_COMPONENT)
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
else()
set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
endif()
string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
"${CMAKE_INSTALL_MANIFEST_FILES}")
file(WRITE "/Users/gengmei/eclipse-workspace/CppTensor/cmake/build/${CMAKE_INSTALL_MANIFEST}"
"${CMAKE_INSTALL_MANIFEST_CONTENT}")
// Generated by the gRPC C++ plugin.
// If you make any local change, they will be lost.
// source: query_analyzer.proto
#include "query_analyzer.pb.h"
#include "query_analyzer.grpc.pb.h"
#include <functional>
#include <grpcpp/impl/codegen/async_stream.h>
#include <grpcpp/impl/codegen/async_unary_call.h>
#include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/codegen/client_unary_call.h>
#include <grpcpp/impl/codegen/client_callback.h>
#include <grpcpp/impl/codegen/message_allocator.h>
#include <grpcpp/impl/codegen/method_handler.h>
#include <grpcpp/impl/codegen/rpc_service_method.h>
#include <grpcpp/impl/codegen/server_callback.h>
#include <grpcpp/impl/codegen/server_callback_handlers.h>
#include <grpcpp/impl/codegen/server_context.h>
#include <grpcpp/impl/codegen/service_type.h>
#include <grpcpp/impl/codegen/sync_stream.h>
namespace QueryAnalyzer {
static const char* QueryInferenceService_method_names[] = {
"/QueryAnalyzer.QueryInferenceService/QueryInference",
};
std::unique_ptr< QueryInferenceService::Stub> QueryInferenceService::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
(void)options;
std::unique_ptr< QueryInferenceService::Stub> stub(new QueryInferenceService::Stub(channel));
return stub;
}
QueryInferenceService::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)
: channel_(channel), rpcmethod_QueryInference_(QueryInferenceService_method_names[0], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
{}
::grpc::Status QueryInferenceService::Stub::QueryInference(::grpc::ClientContext* context, const ::QueryAnalyzer::QueryInferenceRequest& request, ::QueryAnalyzer::QueryInferenceReply* response) {
return ::grpc::internal::BlockingUnaryCall< ::QueryAnalyzer::QueryInferenceRequest, ::QueryAnalyzer::QueryInferenceReply, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_QueryInference_, context, request, response);
}
void QueryInferenceService::Stub::experimental_async::QueryInference(::grpc::ClientContext* context, const ::QueryAnalyzer::QueryInferenceRequest* request, ::QueryAnalyzer::QueryInferenceReply* response, std::function<void(::grpc::Status)> f) {
::grpc::internal::CallbackUnaryCall< ::QueryAnalyzer::QueryInferenceRequest, ::QueryAnalyzer::QueryInferenceReply, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_QueryInference_, context, request, response, std::move(f));
}
void QueryInferenceService::Stub::experimental_async::QueryInference(::grpc::ClientContext* context, const ::QueryAnalyzer::QueryInferenceRequest* request, ::QueryAnalyzer::QueryInferenceReply* response, ::grpc::experimental::ClientUnaryReactor* reactor) {
::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_QueryInference_, context, request, response, reactor);
}
::grpc::ClientAsyncResponseReader< ::QueryAnalyzer::QueryInferenceReply>* QueryInferenceService::Stub::PrepareAsyncQueryInferenceRaw(::grpc::ClientContext* context, const ::QueryAnalyzer::QueryInferenceRequest& request, ::grpc::CompletionQueue* cq) {
return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::QueryAnalyzer::QueryInferenceReply, ::QueryAnalyzer::QueryInferenceRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_QueryInference_, context, request);
}
::grpc::ClientAsyncResponseReader< ::QueryAnalyzer::QueryInferenceReply>* QueryInferenceService::Stub::AsyncQueryInferenceRaw(::grpc::ClientContext* context, const ::QueryAnalyzer::QueryInferenceRequest& request, ::grpc::CompletionQueue* cq) {
auto* result =
this->PrepareAsyncQueryInferenceRaw(context, request, cq);
result->StartCall();
return result;
}
QueryInferenceService::Service::Service() {
AddMethod(new ::grpc::internal::RpcServiceMethod(
QueryInferenceService_method_names[0],
::grpc::internal::RpcMethod::NORMAL_RPC,
new ::grpc::internal::RpcMethodHandler< QueryInferenceService::Service, ::QueryAnalyzer::QueryInferenceRequest, ::QueryAnalyzer::QueryInferenceReply, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
[](QueryInferenceService::Service* service,
::grpc::ServerContext* ctx,
const ::QueryAnalyzer::QueryInferenceRequest* req,
::QueryAnalyzer::QueryInferenceReply* resp) {
return service->QueryInference(ctx, req, resp);
}, this)));
}
QueryInferenceService::Service::~Service() {
}
::grpc::Status QueryInferenceService::Service::QueryInference(::grpc::ServerContext* context, const ::QueryAnalyzer::QueryInferenceRequest* request, ::QueryAnalyzer::QueryInferenceReply* response) {
(void) context;
(void) request;
(void) response;
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
} // namespace QueryAnalyzer
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
option java_multiple_files = true;
option java_package = "io.grpc.examples.helloworld";
option java_outer_classname = "HelloWorldProto";
option objc_class_prefix = "HLW";
package helloworld;
// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
// The request message containing the user's name.
message HelloRequest {
string name = 1;
}
// The response message containing the greetings
message HelloReply {
string message = 1;
}
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
option java_multiple_files = true;
option java_package = "io.grpc.examples.helloworld";
option java_outer_classname = "HelloWorldProto";
option objc_class_prefix = "HLW";
package QueryAnalyzer;
// The QueryInference service definition.
service QueryInferenceService {
rpc QueryInference (QueryInferenceRequest) returns (QueryInferenceReply) {}
}
message QueryInferenceRequest {
string query = 1;
string version_type = 2;
bool return_face = 3;
}
message QueryInferenceReply {
int32 label = 1;
}
#include "redis_manage.h"
#include <string.h>
#include <strings.h>
#include <Poco/Stopwatch.h>
#define RedisNeedAuth 1
RedisManage* RedisManage::_redisIns = NULL;
RedisManage::RedisManage()
: _logger(Logger::get("StrategyServer"))
{
_pConf = ServerConfig::getInstance();
if(NULL == _pConf)
{
_logger.error("getInstance error!");
}
else
{
_redisIp = _pConf->getLocalSettings()._redisServerIp;
_redisAuth = _pConf->getLocalSettings()._redisAuth;
_redisNeedAuth = _pConf->getLocalSettings()._redisNeedAuth;
_redisPort = _pConf->getLocalSettings()._redisServerPort;
_redisTimeOut = _pConf->getLocalSettings()._redisConTimeOut;
_connRetryTimes = _pConf->getLocalSettings()._connRetryTimes;
}
_logger.information(format("redisIp is:%s,redisPort is:%?d,redisTimeOut is:%?d,redisNeedAuth is:%?d,redisAuth is:%s",_redisIp,_redisPort,_redisTimeOut,_redisNeedAuth,_redisAuth));
}
RedisManage::~RedisManage()
{
}
void RedisManage::freeRedisContext(redisContext **pContext)
{
redisFree(*pContext);
}
void RedisManage::getRedisContext(redisContext **pContext)
{
int iRetry = 0;
while(iRetry++ < _connRetryTimes)
{
*pContext = connect(_redisIp, _redisPort, _redisTimeOut);
if(NULL != *pContext)
break;
_logger.error(format("redis connection has retried %?d times",iRetry));
}
if(NULL == *pContext)
{
_logger.error(format("redis context return NULL after %?d retry times,redis connecting Fail!",_connRetryTimes));
}
else
{
if(RedisNeedAuth == _redisNeedAuth)
{
std::string stCmd = string("auth") + string(" ") + _redisAuth;
if(false == set(stCmd,*pContext))
{
_logger.error(format("redis set auth error!,stCmd is:%s",stCmd));
freeRedisContext(pContext);
*pContext = NULL;
}
}
}
}
redisContext* RedisManage::connect(const std::string &stIp, const unsigned int &port, const int &timeout)
{
redisContext *redisCon = NULL;
if( timeout < 0 )
redisCon = redisConnect(stIp.c_str(), port);
else
{
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 1000*timeout;
redisCon = redisConnectWithTimeout(stIp.c_str(), port, tv);
}
if(redisCon == NULL)
{
_logger.error(format("redisConnect error,ip is:%s,port is:%?d",stIp,port));
return NULL;
}
if(redisCon->err != REDIS_OK)
{
_logger.error(format("redisConnect error,ip is:%s,port is:%?d,error_no:%?d,error_msg:%s",stIp,port,redisCon->err,string(redisCon->errstr)));
redisFree(redisCon);
return NULL;
}
return redisCon;
}
RedisManage* RedisManage::getInstance()
{
if(NULL == _redisIns)
{
_redisIns = new RedisManage();
}
return _redisIns;
}
bool RedisManage::get(const std::string &stCommand, std::string &stValue,redisContext *pContext, int *iduration)
{
Stopwatch stopwatch;
stopwatch.start();
if(stCommand.empty())
{
_logger.error("redis key is empty,error!");
return false;
}
redisReply *r = (redisReply*)redisCommand(pContext, stCommand.c_str());
if(NULL == r)
{
_logger.error(format("redisCommand:%s,need check whether the redis_connect(%s:%?d) is normal",stCommand,_redisIp,_redisPort));
return false;
}
if(r->type != REDIS_REPLY_STRING)
{
freeReplyObject(r);
_logger.error(format("redis type is:%?d,Fail to execute command:%s",r->type,stCommand));
return false;
}
stValue = r->str;
freeReplyObject(r);
stopwatch.stop();
if(NULL != iduration)
*iduration = (int)(stopwatch.elapsed()/1000);
return true;
}
redisReply *RedisManage::mget(const std::string &stCommand, redisContext *pContext, int *iduration)
{
Stopwatch stopwatch;
stopwatch.start();
if(stCommand.empty())
{
_logger.error("redis key is empty,error!");
return NULL;
}
redisReply *r = (redisReply*)redisCommand(pContext, stCommand.c_str());
if(NULL == r)
{
_logger.error(format("redisCommand:%s,need check whether the redis_connect(%s:%?d) is normal",stCommand,_redisIp,_redisPort));
return NULL;
}
if(r->type != REDIS_REPLY_ARRAY)
{
freeReplyObject(r);
_logger.error(format("Fail to execute command:[%s]",stCommand));
return NULL;
}
stopwatch.stop();
if(NULL != iduration)
*iduration = (int)(stopwatch.elapsed()/1000);
return r;
}
bool RedisManage::scan(const std::string &stCommand, const int iCount, redisContext *pContext, std::map<string,string> &stMapResult, const char* pMatch, int *iduration)
{
Stopwatch stopwatch;
stopwatch.start();
std::string stFullCmd;
std::stringstream stFullStreamCmd;
stFullStreamCmd << " count " << iCount;
if (NULL != pMatch)
stFullStreamCmd << " match " << pMatch;
std::string stCmdLimit = stFullStreamCmd.str();
std::string stCursor("0");
do
{
stFullCmd = stCommand + std::string(" ") + stCursor + std::string(" ") + stCmdLimit;
redisReply *r = (redisReply*)redisCommand(pContext, stFullCmd.c_str());
if(NULL == r)
{
_logger.error(format("redisCommand:%s error,need check whether the redis_connect(%s:%?d) is normal",stFullCmd,_redisIp,_redisPort));
return false;
}
if(r->type != REDIS_REPLY_ARRAY or r->elements != 2 or r->element[1]->type != REDIS_REPLY_ARRAY)
{
freeReplyObject(r);
_logger.error(format("redisContext type:%?d or element:%?d error,redisCommand is:%s",r->type,r->element,stFullCmd));
return false;
}
stCursor = string(r->element[0]->str);
for(int i=0; i< r->element[1]->elements; i+=2)
{
stMapResult[string(r->element[1]->element[i]->str)] = string(r->element[1]->element[i+1]->str);
}
freeReplyObject(r);
}while(atoi(stCursor.c_str()) != 0);
stopwatch.stop();
if(NULL != iduration)
*iduration = (int)(stopwatch.elapsed()/1000);
return true;
}
bool RedisManage::set(const std::string &stCommand,redisContext *pContext, int *iduration)
{
Stopwatch stopwatch;
stopwatch.start();
if(stCommand.empty())
{
_logger.error("redis key is empty,error!");
return false;
}
redisReply *r = (redisReply*)redisCommand(pContext, stCommand.c_str());
if(NULL == r)
{
_logger.error(format("redisCommand:%s error,need check whether the redis_connect(%s:%?d) is normal",stCommand,_redisIp,_redisPort));
return false;
}
if(!(r->type == REDIS_REPLY_STATUS && strcasecmp(r->str,"ok")==0) && !(r->type == REDIS_REPLY_INTEGER))
{
freeReplyObject(r);
_logger.error(format("Fail to execute command:%s,redis type is:%?d,get str is:%s",stCommand,r->type,string(r->str)));
return false;
}
freeReplyObject(r);
stopwatch.stop();
if(NULL != iduration)
*iduration = (int)(stopwatch.elapsed()/1000);
return true;
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment