Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
424b938c
M
milvus
项目概览
milvus
/
milvus
12 个月 前同步成功
通知
261
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
424b938c
编写于
4月 15, 2019
作者:
X
Xu Peng
提交者:
xj.lin
4月 16, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(db): fix db compile errors
Former-commit-id: 8c013a54ad53efcce47f4f9480164052ecfa9249
上级
d4dae812
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
60 addition
and
32 deletion
+60
-32
cpp/src/db/db.h
cpp/src/db/db.h
+3
-2
cpp/src/db/db_impl.cpp
cpp/src/db/db_impl.cpp
+22
-16
cpp/src/db/db_impl.h
cpp/src/db/db_impl.h
+6
-8
cpp/src/db/db_meta_impl.cpp
cpp/src/db/db_meta_impl.cpp
+2
-2
cpp/src/db/db_meta_impl.h
cpp/src/db/db_meta_impl.h
+2
-2
cpp/src/db/env.cpp
cpp/src/db/env.cpp
+5
-0
cpp/src/db/env.h
cpp/src/db/env.h
+2
-0
cpp/src/db/memvectors.h
cpp/src/db/memvectors.h
+4
-2
cpp/src/db/options.cpp
cpp/src/db/options.cpp
+13
-0
cpp/src/db/options.h
cpp/src/db/options.h
+1
-0
未找到文件。
cpp/src/db/db.h
浏览文件 @
424b938c
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include "options.h"
#include "options.h"
#include "db_meta.h"
#include "db_meta.h"
#include "status.h"
#include "status.h"
#include "types.h"
namespace
zilliz
{
namespace
zilliz
{
namespace
vecwise
{
namespace
vecwise
{
...
@@ -16,7 +17,7 @@ class DB {
...
@@ -16,7 +17,7 @@ class DB {
public:
public:
static
DB
*
Open
(
const
Options
&
options_
,
const
std
::
string
&
name_
);
static
DB
*
Open
(
const
Options
&
options_
,
const
std
::
string
&
name_
);
virtual
Status
add_group
(
GroupOptions
options_
,
virtual
Status
add_group
(
const
GroupOptions
&
options_
,
const
std
::
string
&
group_id_
,
const
std
::
string
&
group_id_
,
GroupSchema
&
group_info_
)
=
0
;
GroupSchema
&
group_info_
)
=
0
;
virtual
Status
get_group
(
const
std
::
string
&
group_id_
,
GroupSchema
&
group_info_
)
=
0
;
virtual
Status
get_group
(
const
std
::
string
&
group_id_
,
GroupSchema
&
group_info_
)
=
0
;
...
@@ -26,7 +27,7 @@ public:
...
@@ -26,7 +27,7 @@ public:
GroupFilesSchema
&
group_files_info_
)
=
0
;
GroupFilesSchema
&
group_files_info_
)
=
0
;
virtual
Status
add_vectors
(
const
std
::
string
&
group_id_
,
virtual
Status
add_vectors
(
const
std
::
string
&
group_id_
,
size_t
n
,
const
float
*
vectors
)
=
0
;
size_t
n
,
const
float
*
vectors
,
IDNumbers
&
vector_ids_
)
=
0
;
DB
()
=
default
;
DB
()
=
default
;
DB
(
const
DB
&
)
=
delete
;
DB
(
const
DB
&
)
=
delete
;
...
...
cpp/src/db/db_impl.cpp
浏览文件 @
424b938c
#include <assert.h>
#include <assert.h>
#include <chrono>
#include <chrono>
#include <thread>
#include "db_impl.h"
#include "db_impl.h"
#include "db_meta_impl.h"
#include "env.h"
namespace
vecengine
{
namespace
zilliz
{
namespace
vecwise
{
namespace
engine
{
DBImpl
::
DBImpl
(
const
Options
&
options_
,
const
std
::
string
&
name_
)
DBImpl
::
DBImpl
(
const
Options
&
options_
,
const
std
::
string
&
name_
)
:
_dbname
(
name_
),
:
_dbname
(
name_
),
_env
(
options_
.
env
),
_env
(
options_
.
env
),
_options
(
options_
),
_options
(
options_
),
_bg_work_finish_signal
(
_mutex
),
_bg_compaction_scheduled
(
false
),
_bg_compaction_scheduled
(
false
),
_shutting_down
(
false
),
_shutting_down
(
false
),
_pMeta
(
new
DBMetaImpl
(
*
(
_options
.
pMetaOptions
))),
_pMeta
(
new
DBMetaImpl
(
*
(
_options
.
pMetaOptions
))),
_pMemMgr
(
new
MemManager
(
_pMeta
))
{
_pMemMgr
(
new
MemManager
(
_pMeta
))
{
start_timer_task
(
Options
.
memory_sync_interval
);
start_timer_task
(
options_
.
memory_sync_interval
);
}
}
Status
DBImpl
::
add_group
(
const
GroupOptions
&
options
_
,
Status
DBImpl
::
add_group
(
const
GroupOptions
&
options
,
const
std
::
string
&
group_id
_
,
const
std
::
string
&
group_id
,
GroupSchema
&
group_info
_
)
{
GroupSchema
&
group_info
)
{
assert
((
!
options
_
.
has_id
)
||
assert
((
!
options
.
has_id
)
||
(
options
_
.
has_id
&&
(
""
!=
group_id_
)));
(
options
.
has_id
&&
(
""
!=
group_id
)));
return
_pMeta
->
add_group
(
options
_
,
group_id
,
group_info_
);
return
_pMeta
->
add_group
(
options
,
group_id
,
group_info
);
}
}
Status
DBImpl
::
get_group
(
const
std
::
string
&
group_id_
,
GroupSchema
&
group_info_
)
{
Status
DBImpl
::
get_group
(
const
std
::
string
&
group_id_
,
GroupSchema
&
group_info_
)
{
...
@@ -33,10 +37,10 @@ Status DBImpl::has_group(const std::string& group_id_, bool& has_or_not_) {
...
@@ -33,10 +37,10 @@ Status DBImpl::has_group(const std::string& group_id_, bool& has_or_not_) {
return
_pMeta
->
has_group
(
group_id_
,
has_or_not_
);
return
_pMeta
->
has_group
(
group_id_
,
has_or_not_
);
}
}
Status
DBImpl
::
get_group_files
(
const
std
::
string
&
group_id
_
,
Status
DBImpl
::
get_group_files
(
const
std
::
string
&
group_id
,
const
int
date_delta
_
,
const
int
date_delta
,
GroupFilesSchema
&
group_files_info
_
)
{
GroupFilesSchema
&
group_files_info
)
{
return
_pMeta
->
get_group_files
(
group_id
_
,
date_delta_
,
group_file_info_
);
return
_pMeta
->
get_group_files
(
group_id
,
date_delta
,
group_files_info
);
}
}
...
@@ -94,10 +98,10 @@ void DBImpl::background_compaction() {
...
@@ -94,10 +98,10 @@ void DBImpl::background_compaction() {
}
}
DBImpl
::~
DBImpl
()
{
DBImpl
::~
DBImpl
()
{
std
::
lock_guard
<
std
::
mutex
>
_mutex
;
std
::
unique_lock
<
std
::
mutex
>
lock
(
_mutex
)
;
_shutting_down
.
store
(
true
,
std
::
memory_order_release
);
_shutting_down
.
store
(
true
,
std
::
memory_order_release
);
while
(
_bg_compaction_scheduled
)
{
while
(
_bg_compaction_scheduled
)
{
_bg_work_finish_signal
.
wait
();
_bg_work_finish_signal
.
wait
(
lock
);
}
}
}
}
...
@@ -112,4 +116,6 @@ DB* DB::Open(const Options& options_, const std::string& name_) {
...
@@ -112,4 +116,6 @@ DB* DB::Open(const Options& options_, const std::string& name_) {
return
impl
;
return
impl
;
}
}
}
// namespace vecengine
}
// namespace engine
}
// namespace vecwise
}
// namespace zilliz
cpp/src/db/db_impl.h
浏览文件 @
424b938c
#ifndef VECENGINE_DB_IMPL_H_
#pragma once
#define VECENGINE_DB_IMPL_H_
#include <mutex>
#include <mutex>
#include <condition_variable>
#include <condition_variable>
#include <memory>
#include <memory>
#include <atomic>
#include "db.h"
#include "db.h"
#include "memvectors.h"
#include "memvectors.h"
#include "types.h"
#include "types.h"
...
@@ -18,7 +18,7 @@ class DBImpl : public DB {
...
@@ -18,7 +18,7 @@ class DBImpl : public DB {
public:
public:
DBImpl
(
const
Options
&
options_
,
const
std
::
string
&
name_
);
DBImpl
(
const
Options
&
options_
,
const
std
::
string
&
name_
);
virtual
Status
add_group
(
GroupOptions
options_
,
virtual
Status
add_group
(
const
GroupOptions
&
options_
,
const
std
::
string
&
group_id_
,
const
std
::
string
&
group_id_
,
GroupSchema
&
group_info_
)
override
;
GroupSchema
&
group_info_
)
override
;
virtual
Status
get_group
(
const
std
::
string
&
group_id_
,
GroupSchema
&
group_info_
)
override
;
virtual
Status
get_group
(
const
std
::
string
&
group_id_
,
GroupSchema
&
group_info_
)
override
;
...
@@ -36,12 +36,14 @@ public:
...
@@ -36,12 +36,14 @@ public:
private:
private:
void
try_schedule_compaction
();
void
try_schedule_compaction
();
void
start_timer_task
(
int
interval_
);
void
background_timer_task
(
int
interval_
);
static
void
BGWork
(
void
*
db
);
static
void
BGWork
(
void
*
db
);
void
background_call
();
void
background_call
();
void
background_compaction
();
void
background_compaction
();
const
_dbname
;
const
std
::
string
&
_dbname
;
Env
*
const
_env
;
Env
*
const
_env
;
const
Options
_options
;
const
Options
_options
;
...
@@ -59,7 +61,3 @@ private:
...
@@ -59,7 +61,3 @@ private:
}
// namespace engine
}
// namespace engine
}
// namespace vecwise
}
// namespace vecwise
}
// namespace zilliz
}
// namespace zilliz
#endif // VECENGINE_DB_META_IMPL_H_
#endif // VECENGINE_DB_IMPL_H_
cpp/src/db/db_meta_impl.cpp
浏览文件 @
424b938c
...
@@ -4,8 +4,8 @@ namespace zilliz {
...
@@ -4,8 +4,8 @@ namespace zilliz {
namespace
vecwise
{
namespace
vecwise
{
namespace
engine
{
namespace
engine
{
DBMetaImpl
::
DBMetaImpl
(
const
DB
MetaOptions
&
options_
)
DBMetaImpl
::
DBMetaImpl
(
const
MetaOptions
&
options_
)
:
_options
(
options_
)
{
:
_options
(
static_cast
<
const
DBMetaOptions
&>
(
options_
)
)
{
initialize
();
initialize
();
}
}
...
...
cpp/src/db/db_meta_impl.h
浏览文件 @
424b938c
...
@@ -10,7 +10,7 @@ namespace engine {
...
@@ -10,7 +10,7 @@ namespace engine {
class
DBMetaImpl
:
public
Meta
{
class
DBMetaImpl
:
public
Meta
{
public:
public:
DBMetaImpl
(
const
DB
MetaOptions
&
options_
);
DBMetaImpl
(
const
MetaOptions
&
options_
);
virtual
Status
add_group
(
const
GroupOptions
&
options_
,
virtual
Status
add_group
(
const
GroupOptions
&
options_
,
const
std
::
string
&
group_id_
,
const
std
::
string
&
group_id_
,
...
@@ -36,7 +36,7 @@ private:
...
@@ -36,7 +36,7 @@ private:
Status
initialize
();
Status
initialize
();
const
DBMetaOptions
_options
;
const
DBMetaOptions
&
_options
;
};
// DBMetaImpl
};
// DBMetaImpl
...
...
cpp/src/db/env.cpp
浏览文件 @
424b938c
...
@@ -43,6 +43,11 @@ void Env::backgroud_thread_main() {
...
@@ -43,6 +43,11 @@ void Env::backgroud_thread_main() {
Env
::~
Env
()
{}
Env
::~
Env
()
{}
Env
*
Env
::
Default
()
{
static
Env
env
;
return
&
env
;
}
}
// namespace engine
}
// namespace engine
}
// namespace vecwise
}
// namespace vecwise
}
// namespace zilliz
}
// namespace zilliz
cpp/src/db/env.h
浏览文件 @
424b938c
...
@@ -21,6 +21,8 @@ public:
...
@@ -21,6 +21,8 @@ public:
virtual
~
Env
();
virtual
~
Env
();
static
Env
*
Default
();
protected:
protected:
void
backgroud_thread_main
();
void
backgroud_thread_main
();
static
void
BackgroundThreadEntryPoint
(
Env
*
env
)
{
static
void
BackgroundThreadEntryPoint
(
Env
*
env
)
{
...
...
cpp/src/db/memvectors.h
浏览文件 @
424b938c
...
@@ -7,8 +7,10 @@
...
@@ -7,8 +7,10 @@
#include "id_generators.h"
#include "id_generators.h"
#include "status.h"
#include "status.h"
class
faiss
::
IndexIDMap
;
namespace
faiss
{
class
faiss
::
Index
;
class
IndexIDMap
;
class
Index
;
}
namespace
zilliz
{
namespace
zilliz
{
...
...
cpp/src/db/options.cpp
0 → 100644
浏览文件 @
424b938c
#include "options.h"
namespace
zilliz
{
namespace
vecwise
{
namespace
engine
{
Options
::
Options
()
:
env
(
Env
::
Default
())
{
}
}
// namespace engine
}
// namespace vecwise
}
// namespace zilliz
cpp/src/db/options.h
浏览文件 @
424b938c
...
@@ -16,6 +16,7 @@ struct Options {
...
@@ -16,6 +16,7 @@ struct Options {
uint16_t
raw_file_merge_trigger_number
=
100
;
uint16_t
raw_file_merge_trigger_number
=
100
;
size_t
raw_to_index_trigger_size
=
100000
;
size_t
raw_to_index_trigger_size
=
100000
;
std
::
shared_ptr
<
MetaOptions
>
pMetaOptions
;
std
::
shared_ptr
<
MetaOptions
>
pMetaOptions
;
Env
*
env
;
};
// Options
};
// Options
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录