Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
7f000e79
M
milvus
项目概览
milvus
/
milvus
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
7f000e79
编写于
4月 30, 2019
作者:
X
Xu Peng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(db): rename
Former-commit-id: 60c982ed5e500d958182bbc0816731d9423b509a
上级
204c6887
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
23 addition
and
23 deletion
+23
-23
cpp/src/db/ExecutionEngine.cpp
cpp/src/db/ExecutionEngine.cpp
+2
-2
cpp/src/db/ExecutionEngine.h
cpp/src/db/ExecutionEngine.h
+2
-2
cpp/src/db/FaissExecutionEngine.cpp
cpp/src/db/FaissExecutionEngine.cpp
+7
-7
cpp/src/db/FaissExecutionEngine.h
cpp/src/db/FaissExecutionEngine.h
+3
-3
cpp/src/db/MemManager.cpp
cpp/src/db/MemManager.cpp
+7
-7
cpp/src/db/MemManager.h
cpp/src/db/MemManager.h
+2
-2
未找到文件。
cpp/src/db/
Serializer
.cpp
→
cpp/src/db/
ExecutionEngine
.cpp
浏览文件 @
7f000e79
#include <easylogging++.h>
#include <easylogging++.h>
#include "
Serializer
.h"
#include "
ExecutionEngine
.h"
namespace
zilliz
{
namespace
zilliz
{
namespace
vecwise
{
namespace
vecwise
{
namespace
engine
{
namespace
engine
{
Status
Serializer
::
AddWithIds
(
const
std
::
vector
<
float
>&
vectors
,
const
std
::
vector
<
long
>&
vector_ids
)
{
Status
ExecutionEngine
::
AddWithIds
(
const
std
::
vector
<
float
>&
vectors
,
const
std
::
vector
<
long
>&
vector_ids
)
{
long
n1
=
(
long
)
vectors
.
size
();
long
n1
=
(
long
)
vectors
.
size
();
long
n2
=
(
long
)
vector_ids
.
size
();
long
n2
=
(
long
)
vector_ids
.
size
();
if
(
n1
!=
n2
)
{
if
(
n1
!=
n2
)
{
...
...
cpp/src/db/
Serializer
.h
→
cpp/src/db/
ExecutionEngine
.h
浏览文件 @
7f000e79
...
@@ -8,7 +8,7 @@ namespace zilliz {
...
@@ -8,7 +8,7 @@ namespace zilliz {
namespace
vecwise
{
namespace
vecwise
{
namespace
engine
{
namespace
engine
{
class
Serializer
{
class
ExecutionEngine
{
public:
public:
Status
AddWithIds
(
const
std
::
vector
<
float
>&
vectors
,
Status
AddWithIds
(
const
std
::
vector
<
float
>&
vectors
,
...
@@ -24,7 +24,7 @@ public:
...
@@ -24,7 +24,7 @@ public:
virtual
Status
Cache
()
=
0
;
virtual
Status
Cache
()
=
0
;
virtual
~
Serializer
()
{}
virtual
~
ExecutionEngine
()
{}
};
};
...
...
cpp/src/db/Faiss
Serializer
.cpp
→
cpp/src/db/Faiss
ExecutionEngine
.cpp
浏览文件 @
7f000e79
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#include <wrapper/Index.h>
#include <wrapper/Index.h>
#include <cache/CpuCacheMgr.h>
#include <cache/CpuCacheMgr.h>
#include "Faiss
Serializer
.h"
#include "Faiss
ExecutionEngine
.h"
namespace
zilliz
{
namespace
zilliz
{
namespace
vecwise
{
namespace
vecwise
{
...
@@ -11,30 +11,30 @@ namespace engine {
...
@@ -11,30 +11,30 @@ namespace engine {
const
std
::
string
IndexType
=
"IDMap,Flat"
;
const
std
::
string
IndexType
=
"IDMap,Flat"
;
Faiss
Serializer
::
FaissSerializer
(
uint16_t
dimension
,
const
std
::
string
&
location
)
Faiss
ExecutionEngine
::
FaissExecutionEngine
(
uint16_t
dimension
,
const
std
::
string
&
location
)
:
pIndex_
(
faiss
::
index_factory
(
dimension
,
IndexType
.
c_str
())),
:
pIndex_
(
faiss
::
index_factory
(
dimension
,
IndexType
.
c_str
())),
location_
(
location
)
{
location_
(
location
)
{
}
}
Status
Faiss
Serializer
::
AddWithIds
(
long
n
,
const
float
*
xdata
,
const
long
*
xids
)
{
Status
Faiss
ExecutionEngine
::
AddWithIds
(
long
n
,
const
float
*
xdata
,
const
long
*
xids
)
{
pIndex_
->
add_with_ids
(
n
,
xdata
,
xids
);
pIndex_
->
add_with_ids
(
n
,
xdata
,
xids
);
return
Status
::
OK
();
return
Status
::
OK
();
}
}
size_t
Faiss
Serializer
::
Count
()
const
{
size_t
Faiss
ExecutionEngine
::
Count
()
const
{
return
(
size_t
)(
pIndex_
->
ntotal
);
return
(
size_t
)(
pIndex_
->
ntotal
);
}
}
size_t
Faiss
Serializer
::
Size
()
const
{
size_t
Faiss
ExecutionEngine
::
Size
()
const
{
return
(
size_t
)(
Count
()
*
pIndex_
->
d
);
return
(
size_t
)(
Count
()
*
pIndex_
->
d
);
}
}
Status
Faiss
Serializer
::
Serialize
()
{
Status
Faiss
ExecutionEngine
::
Serialize
()
{
write_index
(
pIndex_
.
get
(),
location_
.
c_str
());
write_index
(
pIndex_
.
get
(),
location_
.
c_str
());
return
Status
::
OK
();
return
Status
::
OK
();
}
}
Status
Faiss
Serializer
::
Cache
()
{
Status
Faiss
ExecutionEngine
::
Cache
()
{
zilliz
::
vecwise
::
cache
::
CpuCacheMgr
::
GetInstance
(
zilliz
::
vecwise
::
cache
::
CpuCacheMgr
::
GetInstance
(
)
->
InsertItem
(
location_
,
std
::
make_shared
<
Index
>
(
pIndex_
));
)
->
InsertItem
(
location_
,
std
::
make_shared
<
Index
>
(
pIndex_
));
...
...
cpp/src/db/Faiss
Serializer
.h
→
cpp/src/db/Faiss
ExecutionEngine
.h
浏览文件 @
7f000e79
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#include <memory>
#include <memory>
#include <string>
#include <string>
#include "
Serializer
.h"
#include "
ExecutionEngine
.h"
namespace
faiss
{
namespace
faiss
{
class
Index
;
class
Index
;
...
@@ -13,9 +13,9 @@ namespace zilliz {
...
@@ -13,9 +13,9 @@ namespace zilliz {
namespace
vecwise
{
namespace
vecwise
{
namespace
engine
{
namespace
engine
{
class
Faiss
Serializer
:
public
Serializer
{
class
Faiss
ExecutionEngine
:
public
ExecutionEngine
{
public:
public:
Faiss
Serializer
(
uint16_t
dimension
,
const
std
::
string
&
location
);
Faiss
ExecutionEngine
(
uint16_t
dimension
,
const
std
::
string
&
location
);
virtual
Status
AddWithIds
(
long
n
,
const
float
*
xdata
,
const
long
*
xids
)
override
;
virtual
Status
AddWithIds
(
long
n
,
const
float
*
xdata
,
const
long
*
xids
)
override
;
virtual
size_t
Count
()
const
override
;
virtual
size_t
Count
()
const
override
;
...
...
cpp/src/db/MemManager.cpp
浏览文件 @
7f000e79
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
#include "MemManager.h"
#include "MemManager.h"
#include "Meta.h"
#include "Meta.h"
#include "Faiss
Serializer
.h"
#include "Faiss
ExecutionEngine
.h"
namespace
zilliz
{
namespace
zilliz
{
...
@@ -19,36 +19,36 @@ MemVectors::MemVectors(const std::shared_ptr<meta::Meta>& meta_ptr,
...
@@ -19,36 +19,36 @@ MemVectors::MemVectors(const std::shared_ptr<meta::Meta>& meta_ptr,
options_
(
options
),
options_
(
options
),
schema_
(
schema
),
schema_
(
schema
),
_pIdGenerator
(
new
SimpleIDGenerator
()),
_pIdGenerator
(
new
SimpleIDGenerator
()),
p
Serializer_
(
new
FaissSerializer
(
schema_
.
dimension
,
schema_
.
location
))
{
p
EE_
(
new
FaissExecutionEngine
(
schema_
.
dimension
,
schema_
.
location
))
{
}
}
void
MemVectors
::
add
(
size_t
n_
,
const
float
*
vectors_
,
IDNumbers
&
vector_ids_
)
{
void
MemVectors
::
add
(
size_t
n_
,
const
float
*
vectors_
,
IDNumbers
&
vector_ids_
)
{
_pIdGenerator
->
getNextIDNumbers
(
n_
,
vector_ids_
);
_pIdGenerator
->
getNextIDNumbers
(
n_
,
vector_ids_
);
p
Serializer
_
->
AddWithIds
(
n_
,
vectors_
,
vector_ids_
.
data
());
p
EE
_
->
AddWithIds
(
n_
,
vectors_
,
vector_ids_
.
data
());
for
(
auto
i
=
0
;
i
<
n_
;
i
++
)
{
for
(
auto
i
=
0
;
i
<
n_
;
i
++
)
{
vector_ids_
.
push_back
(
i
);
vector_ids_
.
push_back
(
i
);
}
}
}
}
size_t
MemVectors
::
total
()
const
{
size_t
MemVectors
::
total
()
const
{
return
p
Serializer
_
->
Count
();
return
p
EE
_
->
Count
();
}
}
size_t
MemVectors
::
approximate_size
()
const
{
size_t
MemVectors
::
approximate_size
()
const
{
return
p
Serializer
_
->
Size
();
return
p
EE
_
->
Size
();
}
}
Status
MemVectors
::
serialize
(
std
::
string
&
group_id
)
{
Status
MemVectors
::
serialize
(
std
::
string
&
group_id
)
{
group_id
=
schema_
.
group_id
;
group_id
=
schema_
.
group_id
;
auto
rows
=
approximate_size
();
auto
rows
=
approximate_size
();
p
Serializer
_
->
Serialize
();
p
EE
_
->
Serialize
();
schema_
.
rows
=
rows
;
schema_
.
rows
=
rows
;
schema_
.
file_type
=
(
rows
>=
options_
.
index_trigger_size
)
?
schema_
.
file_type
=
(
rows
>=
options_
.
index_trigger_size
)
?
meta
::
GroupFileSchema
::
TO_INDEX
:
meta
::
GroupFileSchema
::
RAW
;
meta
::
GroupFileSchema
::
TO_INDEX
:
meta
::
GroupFileSchema
::
RAW
;
auto
status
=
pMeta_
->
update_group_file
(
schema_
);
auto
status
=
pMeta_
->
update_group_file
(
schema_
);
p
Serializer
_
->
Cache
();
p
EE
_
->
Cache
();
return
status
;
return
status
;
}
}
...
...
cpp/src/db/MemManager.h
浏览文件 @
7f000e79
...
@@ -19,7 +19,7 @@ namespace meta {
...
@@ -19,7 +19,7 @@ namespace meta {
class
Meta
;
class
Meta
;
}
}
class
Serializer
;
class
ExecutionEngine
;
class
MemVectors
{
class
MemVectors
{
public:
public:
...
@@ -47,7 +47,7 @@ private:
...
@@ -47,7 +47,7 @@ private:
Options
options_
;
Options
options_
;
meta
::
GroupFileSchema
schema_
;
meta
::
GroupFileSchema
schema_
;
IDGenerator
*
_pIdGenerator
;
IDGenerator
*
_pIdGenerator
;
std
::
shared_ptr
<
Serializer
>
pSerializer
_
;
std
::
shared_ptr
<
ExecutionEngine
>
pEE
_
;
};
// MemVectors
};
// MemVectors
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录