mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-06 19:02:18 +08:00
Add license check functions
Former-commit-id: d3120c7b805a59bcb736908990d68652008eca8d
This commit is contained in:
parent
56ffd6bad3
commit
51d9e2c21e
@ -11,6 +11,10 @@ aux_source_directory(utils utils_files)
|
||||
aux_source_directory(db db_files)
|
||||
aux_source_directory(wrapper wrapper_files)
|
||||
|
||||
set(license_check_files
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/license/License.cpp
|
||||
)
|
||||
|
||||
set(service_files
|
||||
thrift/gen-cpp/VecService.cpp
|
||||
thrift/gen-cpp/VectorService_constants.cpp
|
||||
@ -49,6 +53,7 @@ add_executable(vecwise_server
|
||||
${server_files}
|
||||
${utils_files}
|
||||
${service_files}
|
||||
${license_check_files}
|
||||
${VECWISE_THIRD_PARTY_BUILD}/include/easylogging++.cc
|
||||
)
|
||||
|
||||
@ -69,3 +74,8 @@ set(server_libs
|
||||
)
|
||||
|
||||
target_link_libraries(vecwise_server ${server_libs})
|
||||
|
||||
set(license_generator_src
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/license/LicenseGenerator.cpp)
|
||||
|
||||
add_executable(license_generator ${license_generator_src})
|
||||
|
||||
14
cpp/src/license/License.cpp
Normal file
14
cpp/src/license/License.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "License.h"
|
||||
|
||||
namespace zilliz {
|
||||
namespace vecwise {
|
||||
namespace server {
|
||||
|
||||
ServerError
|
||||
LicenseValidate(const std::string& path) {
|
||||
return SERVER_SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
16
cpp/src/license/License.h
Normal file
16
cpp/src/license/License.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "utils/Error.h"
|
||||
|
||||
namespace zilliz {
|
||||
namespace vecwise {
|
||||
namespace server {
|
||||
|
||||
ServerError
|
||||
LicenseValidate(const std::string& path);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
6
cpp/src/license/LicenseGenerator.cpp
Normal file
6
cpp/src/license/LicenseGenerator.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "This is license generator" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@ -9,7 +9,7 @@
|
||||
#include "utils/Log.h"
|
||||
#include "utils/SignalUtil.h"
|
||||
#include "utils/TimeRecorder.h"
|
||||
|
||||
#include "license/License.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
@ -133,6 +133,12 @@ Server::Daemonize() {
|
||||
|
||||
int
|
||||
Server::Start() {
|
||||
std::string license_file_path = "/tmp/vecwise.license";
|
||||
if(LicenseValidate(license_file_path) != SERVER_SUCCESS) {
|
||||
SERVER_LOG_ERROR << "License check failed";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (daemonized_) {
|
||||
Daemonize();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user