Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
cf7f5596
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cf7f5596
编写于
6月 23, 2019
作者:
G
groot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
display initial info
Former-commit-id: 2ae5fe00af394147d863e2c1f27dd5ae3989a665
上级
68767a9f
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
27 addition
and
27 deletion
+27
-27
cpp/src/license/LicenseCheck.cpp
cpp/src/license/LicenseCheck.cpp
+8
-8
cpp/src/main.cpp
cpp/src/main.cpp
+13
-13
cpp/src/server/Server.cpp
cpp/src/server/Server.cpp
+6
-6
未找到文件。
cpp/src/license/LicenseCheck.cpp
浏览文件 @
cf7f5596
...
@@ -47,27 +47,27 @@ LicenseCheck::LegalityCheck(const std::string &license_file_path) {
...
@@ -47,27 +47,27 @@ LicenseCheck::LegalityCheck(const std::string &license_file_path) {
end_time
);
end_time
);
if
(
err
!=
SERVER_SUCCESS
)
if
(
err
!=
SERVER_SUCCESS
)
{
{
printf
(
"License check error: 01
\n
"
)
;
std
::
cout
<<
"License check error: 01"
<<
std
::
endl
;
return
SERVER_UNEXPECTED_ERROR
;
return
SERVER_UNEXPECTED_ERROR
;
}
}
time_t
system_time
;
time_t
system_time
;
LicenseLibrary
::
GetSystemTime
(
system_time
);
LicenseLibrary
::
GetSystemTime
(
system_time
);
if
(
device_count
!=
output_device_count
)
{
if
(
device_count
!=
output_device_count
)
{
printf
(
"License check error: 02
\n
"
)
;
std
::
cout
<<
"License check error: 02"
<<
std
::
endl
;
return
SERVER_UNEXPECTED_ERROR
;
return
SERVER_UNEXPECTED_ERROR
;
}
}
for
(
int
i
=
0
;
i
<
device_count
;
++
i
)
{
for
(
int
i
=
0
;
i
<
device_count
;
++
i
)
{
if
(
sha_array
[
i
]
!=
uuid_encryption_map
[
i
])
{
if
(
sha_array
[
i
]
!=
uuid_encryption_map
[
i
])
{
printf
(
"License check error: 03
\n
"
)
;
std
::
cout
<<
"License check error: 03"
<<
std
::
endl
;
return
SERVER_UNEXPECTED_ERROR
;
return
SERVER_UNEXPECTED_ERROR
;
}
}
}
}
if
(
system_time
<
starting_time
||
system_time
>
end_time
)
{
if
(
system_time
<
starting_time
||
system_time
>
end_time
)
{
printf
(
"License check error: 04
\n
"
)
;
std
::
cout
<<
"License check error: 04"
<<
std
::
endl
;
return
SERVER_UNEXPECTED_ERROR
;
return
SERVER_UNEXPECTED_ERROR
;
}
}
printf
(
"Legality Check Success
\n
"
)
;
std
::
cout
<<
"Legality Check Success"
<<
std
::
endl
;
return
SERVER_SUCCESS
;
return
SERVER_SUCCESS
;
}
}
...
@@ -80,11 +80,11 @@ LicenseCheck::AlterFile(const std::string &license_file_path,
...
@@ -80,11 +80,11 @@ LicenseCheck::AlterFile(const std::string &license_file_path,
ServerError
err
=
LicenseCheck
::
LegalityCheck
(
license_file_path
);
ServerError
err
=
LicenseCheck
::
LegalityCheck
(
license_file_path
);
if
(
err
!=
SERVER_SUCCESS
)
{
if
(
err
!=
SERVER_SUCCESS
)
{
printf
(
"license file check error
\n
"
)
;
std
::
cout
<<
"license file check error"
<<
std
::
endl
;
exit
(
1
);
exit
(
1
);
}
}
printf
(
"---runing---
\n
"
)
;
std
::
cout
<<
"---runing---"
<<
std
::
endl
;
pt
->
expires_at
(
pt
->
expires_at
()
+
boost
::
posix_time
::
hours
(
1
));
pt
->
expires_at
(
pt
->
expires_at
()
+
boost
::
posix_time
::
hours
(
1
));
pt
->
async_wait
(
boost
::
bind
(
LicenseCheck
::
AlterFile
,
license_file_path
,
boost
::
asio
::
placeholders
::
error
,
pt
));
pt
->
async_wait
(
boost
::
bind
(
LicenseCheck
::
AlterFile
,
license_file_path
,
boost
::
asio
::
placeholders
::
error
,
pt
));
...
@@ -96,7 +96,7 @@ ServerError
...
@@ -96,7 +96,7 @@ ServerError
LicenseCheck
::
StartCountingDown
(
const
std
::
string
&
license_file_path
)
{
LicenseCheck
::
StartCountingDown
(
const
std
::
string
&
license_file_path
)
{
if
(
!
LicenseLibrary
::
IsFileExistent
(
license_file_path
))
{
if
(
!
LicenseLibrary
::
IsFileExistent
(
license_file_path
))
{
printf
(
"license file not exist
\n
"
)
;
std
::
cout
<<
"license file not exist"
<<
std
::
endl
;
exit
(
1
);
exit
(
1
);
}
}
...
...
cpp/src/main.cpp
浏览文件 @
cf7f5596
...
@@ -26,8 +26,8 @@ using namespace zilliz::milvus;
...
@@ -26,8 +26,8 @@ using namespace zilliz::milvus;
int
int
main
(
int
argc
,
char
*
argv
[])
{
main
(
int
argc
,
char
*
argv
[])
{
printf
(
"
\n
Welcome to use Milvus by Zillz!
\n
"
)
;
std
::
cout
<<
std
::
endl
<<
"Welcome to use Milvus by Zillz!"
<<
std
::
endl
;
printf
(
"Milvus %s version: v%s built at %s
\n
"
,
BUILD_TYPE
,
MILVUS_VERSION
,
BUILD_TIME
)
;
std
::
cout
<<
"Milvus "
<<
BUILD_TYPE
<<
" version: v"
<<
MILVUS_VERSION
<<
" built at "
<<
BUILD_TIME
<<
std
::
endl
;
signal
(
SIGINT
,
server
::
SignalUtil
::
HandleSignal
);
signal
(
SIGINT
,
server
::
SignalUtil
::
HandleSignal
);
signal
(
SIGSEGV
,
server
::
SignalUtil
::
HandleSignal
);
signal
(
SIGSEGV
,
server
::
SignalUtil
::
HandleSignal
);
...
@@ -53,7 +53,7 @@ main(int argc, char *argv[]) {
...
@@ -53,7 +53,7 @@ main(int argc, char *argv[]) {
if
(
argc
<
2
)
{
if
(
argc
<
2
)
{
print_help
(
app_name
);
print_help
(
app_name
);
printf
(
"Milvus server exit...
\n
"
)
;
std
::
cout
<<
"Milvus server exit..."
<<
std
::
endl
;
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
}
}
...
@@ -64,14 +64,14 @@ main(int argc, char *argv[]) {
...
@@ -64,14 +64,14 @@ main(int argc, char *argv[]) {
char
*
config_filename_ptr
=
strdup
(
optarg
);
char
*
config_filename_ptr
=
strdup
(
optarg
);
config_filename
=
config_filename_ptr
;
config_filename
=
config_filename_ptr
;
free
(
config_filename_ptr
);
free
(
config_filename_ptr
);
printf
(
"Loading configuration from: %s
\n
"
,
config_filename
.
c_str
())
;
std
::
cout
<<
"Loading configuration from: "
<<
config_filename
<<
std
::
endl
;
break
;
break
;
}
}
case
'l'
:
{
case
'l'
:
{
char
*
log_filename_ptr
=
strdup
(
optarg
);
char
*
log_filename_ptr
=
strdup
(
optarg
);
log_config_file
=
log_filename_ptr
;
log_config_file
=
log_filename_ptr
;
free
(
log_filename_ptr
);
free
(
log_filename_ptr
);
printf
(
"Initial log config from: %s
\n
"
,
log_config_file
.
c_str
())
;
std
::
cout
<<
"Initial log config from: "
<<
log_config_file
<<
std
::
endl
;
break
;
break
;
}
}
...
@@ -79,7 +79,7 @@ main(int argc, char *argv[]) {
...
@@ -79,7 +79,7 @@ main(int argc, char *argv[]) {
char
*
pid_filename_ptr
=
strdup
(
optarg
);
char
*
pid_filename_ptr
=
strdup
(
optarg
);
pid_filename
=
pid_filename_ptr
;
pid_filename
=
pid_filename_ptr
;
free
(
pid_filename_ptr
);
free
(
pid_filename_ptr
);
printf
(
"%s
\n
"
,
pid_filename
.
c_str
())
;
std
::
cout
<<
pid_filename
<<
std
::
endl
;
break
;
break
;
}
}
...
@@ -107,11 +107,11 @@ main(int argc, char *argv[]) {
...
@@ -107,11 +107,11 @@ main(int argc, char *argv[]) {
void
void
print_help
(
const
std
::
string
&
app_name
)
{
print_help
(
const
std
::
string
&
app_name
)
{
printf
(
"
\n
Usage: %s [OPTIONS]
\n\n
"
,
app_name
.
c_str
())
;
std
::
cout
<<
std
::
endl
<<
"Usage: "
<<
app_name
<<
" [OPTIONS]"
<<
std
::
endl
<<
std
::
endl
;
printf
(
" Options:
\n
"
)
;
std
::
cout
<<
" Options:"
<<
std
::
endl
;
printf
(
" -h --help Print this help
\n
"
)
;
std
::
cout
<<
" -h --help Print this help"
<<
std
::
endl
;
printf
(
" -c --conf_file filename Read configuration from the file
\n
"
)
;
std
::
cout
<<
" -c --conf_file filename Read configuration from the file"
<<
std
::
endl
;
printf
(
" -d --daemon Daemonize this application
\n
"
)
;
std
::
cout
<<
" -d --daemon Daemonize this application"
<<
std
::
endl
;
printf
(
" -p --pid_file filename PID file used by daemonized app
\n
"
)
;
std
::
cout
<<
" -p --pid_file filename PID file used by daemonized app"
<<
std
::
endl
;
printf
(
"
\n
"
)
;
std
::
cout
<<
std
::
endl
;
}
}
cpp/src/server/Server.cpp
浏览文件 @
cf7f5596
...
@@ -171,7 +171,7 @@ Server::Start() {
...
@@ -171,7 +171,7 @@ Server::Start() {
signal
(
SIGTERM
,
SignalUtil
::
HandleSignal
);
signal
(
SIGTERM
,
SignalUtil
::
HandleSignal
);
server
::
Metrics
::
GetInstance
().
Init
();
server
::
Metrics
::
GetInstance
().
Init
();
server
::
SystemInfo
::
GetInstance
().
Init
();
server
::
SystemInfo
::
GetInstance
().
Init
();
printf
(
"Milvus server start successfully.
\n
"
)
;
std
::
cout
<<
"Milvus server start successfully."
<<
std
::
endl
;
StartService
();
StartService
();
}
catch
(
std
::
exception
&
ex
){
}
catch
(
std
::
exception
&
ex
){
...
@@ -187,18 +187,18 @@ Server::Start() {
...
@@ -187,18 +187,18 @@ Server::Start() {
void
void
Server
::
Stop
()
{
Server
::
Stop
()
{
printf
(
"Milvus server is going to shutdown ...
\n
"
)
;
std
::
cout
<<
"Milvus server is going to shutdown ..."
<<
std
::
endl
;
// Unlock and close lockfile
// Unlock and close lockfile
if
(
pid_fd
!=
-
1
)
{
if
(
pid_fd
!=
-
1
)
{
int
ret
=
lockf
(
pid_fd
,
F_ULOCK
,
0
);
int
ret
=
lockf
(
pid_fd
,
F_ULOCK
,
0
);
if
(
ret
!=
0
){
if
(
ret
!=
0
){
printf
(
"Can't lock file: %s
\n
"
,
strerror
(
errno
))
;
std
::
cout
<<
"Can't lock file: "
<<
strerror
(
errno
)
<<
std
::
endl
;
exit
(
0
);
exit
(
0
);
}
}
ret
=
close
(
pid_fd
);
ret
=
close
(
pid_fd
);
if
(
ret
!=
0
){
if
(
ret
!=
0
){
printf
(
"Can't close file: %s
\n
"
,
strerror
(
errno
))
;
std
::
cout
<<
"Can't close file: "
<<
strerror
(
errno
)
<<
std
::
endl
;
exit
(
0
);
exit
(
0
);
}
}
}
}
...
@@ -207,7 +207,7 @@ Server::Stop() {
...
@@ -207,7 +207,7 @@ Server::Stop() {
if
(
!
pid_filename_
.
empty
())
{
if
(
!
pid_filename_
.
empty
())
{
int
ret
=
unlink
(
pid_filename_
.
c_str
());
int
ret
=
unlink
(
pid_filename_
.
c_str
());
if
(
ret
!=
0
){
if
(
ret
!=
0
){
printf
(
"Can't unlink file: %s
\n
"
,
strerror
(
errno
))
;
std
::
cout
<<
"Can't unlink file: "
<<
strerror
(
errno
)
<<
std
::
endl
;
exit
(
0
);
exit
(
0
);
}
}
}
}
...
@@ -219,7 +219,7 @@ Server::Stop() {
...
@@ -219,7 +219,7 @@ Server::Stop() {
#ifdef ENABLE_LICENSE
#ifdef ENABLE_LICENSE
server
::
LicenseCheck
::
GetInstance
().
StopCountingDown
();
server
::
LicenseCheck
::
GetInstance
().
StopCountingDown
();
#endif
#endif
printf
(
"Milvus server is closed!
\n
"
)
;
std
::
cout
<<
"Milvus server is closed!"
<<
std
::
endl
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录