Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_35024513
milvus
提交
cd4b667b
milvus
项目概览
qq_35024513
/
milvus
与 Fork 源项目一致
Fork自
milvus / milvus
通知
14
Star
0
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,发现更多精彩内容 >>
未验证
提交
cd4b667b
编写于
7月 28, 2020
作者:
B
BossZou
提交者:
GitHub
7月 28, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update InactiveResourceGCEvent (#3051)
Signed-off-by:
N
yhz
<
413554850@qq.com
>
上级
5b1fdcf7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
20 deletion
+30
-20
core/src/db/snapshot/InActiveResourcesGCEvent.h
core/src/db/snapshot/InActiveResourcesGCEvent.h
+2
-1
core/src/db/snapshot/MetaEvent.h
core/src/db/snapshot/MetaEvent.h
+25
-0
core/src/db/snapshot/ResourceGCEvent.h
core/src/db/snapshot/ResourceGCEvent.h
+3
-19
未找到文件。
core/src/db/snapshot/InActiveResourcesGCEvent.h
浏览文件 @
cd4b667b
...
...
@@ -26,7 +26,7 @@ namespace milvus {
namespace
engine
{
namespace
snapshot
{
class
InActiveResourcesGCEvent
:
public
Meta
Event
,
public
Operations
{
class
InActiveResourcesGCEvent
:
public
GC
Event
,
public
Operations
{
public:
using
Ptr
=
std
::
shared_ptr
<
InActiveResourcesGCEvent
>
;
...
...
@@ -77,6 +77,7 @@ class InActiveResourcesGCEvent : public MetaEvent, public Operations {
auto
ok
=
boost
::
filesystem
::
remove
(
res_path
);
/* std::cout << "[GC] Remove file " << res_->ToString() << " " << res_path << " " << ok << std::endl; */
}
else
{
RemoveWithSuffix
<
ResourceT
>
(
res
,
res_path
,
store
->
GetSuffixSet
());
std
::
cout
<<
"[GC] Remove stale "
<<
res_path
<<
" for "
<<
res
->
ToString
()
<<
std
::
endl
;
}
...
...
core/src/db/snapshot/MetaEvent.h
浏览文件 @
cd4b667b
...
...
@@ -11,6 +11,11 @@
#pragma once
#include <set>
#include <string>
#include <boost/filesystem.hpp>
#include "db/snapshot/Store.h"
#include "utils/Status.h"
...
...
@@ -23,6 +28,26 @@ class MetaEvent {
virtual
Status
Process
(
StorePtr
)
=
0
;
};
class
GCEvent
:
virtual
public
MetaEvent
{
protected:
template
<
class
ResourceT
>
void
RemoveWithSuffix
(
typename
ResourceT
::
Ptr
res
,
const
std
::
string
&
path
,
const
std
::
set
<
std
::
string
>&
suffix_set
)
{
for
(
auto
&
suffix
:
suffix_set
)
{
if
(
suffix
.
empty
())
{
continue
;
}
auto
adjusted
=
path
+
suffix
;
if
(
boost
::
filesystem
::
is_regular_file
(
adjusted
))
{
auto
ok
=
boost
::
filesystem
::
remove
(
adjusted
);
std
::
cout
<<
"[GC] Remove FILE "
<<
res
->
ToString
()
<<
" "
<<
adjusted
<<
" "
<<
ok
<<
std
::
endl
;
return
;
}
}
std
::
cout
<<
"[GC] Remove STALE OBJECT "
<<
path
<<
" for "
<<
res
->
ToString
()
<<
std
::
endl
;
}
};
}
// namespace snapshot
}
// namespace engine
}
// namespace milvus
core/src/db/snapshot/ResourceGCEvent.h
浏览文件 @
cd4b667b
...
...
@@ -25,7 +25,7 @@
namespace
milvus
::
engine
::
snapshot
{
template
<
class
ResourceT
>
class
ResourceGCEvent
:
public
Meta
Event
{
class
ResourceGCEvent
:
public
GC
Event
{
public:
using
Ptr
=
std
::
shared_ptr
<
ResourceGCEvent
>
;
...
...
@@ -52,7 +52,7 @@ class ResourceGCEvent : public MetaEvent {
auto
ok
=
boost
::
filesystem
::
remove
(
res_path
);
std
::
cout
<<
"[GC] Remove FILE "
<<
res_
->
ToString
()
<<
" "
<<
res_path
<<
" "
<<
ok
<<
std
::
endl
;
}
else
{
RemoveWithSuffix
(
res_path
,
store
->
GetSuffixSet
());
RemoveWithSuffix
<
ResourceT
>
(
res_
,
res_path
,
store
->
GetSuffixSet
());
}
/* remove resource from meta */
...
...
@@ -63,23 +63,7 @@ class ResourceGCEvent : public MetaEvent {
}
private:
void
RemoveWithSuffix
(
const
std
::
string
&
path
,
const
std
::
set
<
std
::
string
>&
suffix_set
)
{
for
(
auto
&
suffix
:
suffix_set
)
{
if
(
suffix
.
empty
())
{
continue
;
}
auto
adjusted
=
path
+
suffix
;
if
(
boost
::
filesystem
::
is_regular_file
(
adjusted
))
{
auto
ok
=
boost
::
filesystem
::
remove
(
adjusted
);
std
::
cout
<<
"[GC] Remove FILE "
<<
res_
->
ToString
()
<<
" "
<<
adjusted
<<
" "
<<
ok
<<
std
::
endl
;
return
;
}
}
std
::
cout
<<
"[GC] Remove STALE OBJECT "
<<
path
<<
" for "
<<
res_
->
ToString
()
<<
std
::
endl
;
}
class
ResourceT
::
Ptr
res_
;
typename
ResourceT
::
Ptr
res_
;
};
}
// namespace milvus::engine::snapshot
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录