Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
2640dfeb
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,发现更多精彩内容 >>
未验证
提交
2640dfeb
编写于
10月 05, 2021
作者:
C
cai.zhang
提交者:
GitHub
10月 05, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[skip ci]Fix golint in indexnode/indexnode_mock.go (#9120)
Signed-off-by:
N
cai.zhang
<
cai.zhang@zilliz.com
>
上级
1d9a04ce
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
0 deletion
+13
-0
internal/indexnode/indexnode_mock.go
internal/indexnode/indexnode_mock.go
+13
-0
未找到文件。
internal/indexnode/indexnode_mock.go
浏览文件 @
2640dfeb
...
...
@@ -31,6 +31,7 @@ import (
"github.com/milvus-io/milvus/internal/util/typeutil"
)
// Mock is an alternative to IndexNode, it will return specific results based on specific parameters.
type
Mock
struct
{
Build
bool
Failure
bool
...
...
@@ -45,6 +46,7 @@ type Mock struct {
buildIndex
chan
*
indexpb
.
CreateIndexRequest
}
// Init initializes the Mock of IndexNode. If the internal member `Err` is True, return an error.
func
(
inm
*
Mock
)
Init
()
error
{
if
inm
.
Err
{
return
errors
.
New
(
"IndexNode init failed"
)
...
...
@@ -146,6 +148,7 @@ func (inm *Mock) buildIndexTask() {
}
}
// Start starts the Mock of IndexNode. If the internal member `Err` is true, it will return an error.
func
(
inm
*
Mock
)
Start
()
error
{
if
inm
.
Err
{
return
errors
.
New
(
"IndexNode start failed"
)
...
...
@@ -155,6 +158,7 @@ func (inm *Mock) Start() error {
return
nil
}
// Stop stops the Mock of IndexNode. If the internal member `Err` is true, it will return an error.
func
(
inm
*
Mock
)
Stop
()
error
{
if
inm
.
Err
{
return
errors
.
New
(
"IndexNode stop failed"
)
...
...
@@ -165,6 +169,7 @@ func (inm *Mock) Stop() error {
return
nil
}
// Register registers an IndexNode role in ETCD, if the internal member `Err` is true, it will return an error.
func
(
inm
*
Mock
)
Register
()
error
{
if
inm
.
Err
{
return
errors
.
New
(
"IndexNode register failed"
)
...
...
@@ -177,6 +182,8 @@ func (inm *Mock) Register() error {
return
nil
}
// GetComponentStates gets the component states of the mocked IndexNode, if the internal member `Err` is true, it will return an error,
// and the state is `StateCode_Abnormal`. Under normal circumstances the state is `StateCode_Healthy`.
func
(
inm
*
Mock
)
GetComponentStates
(
ctx
context
.
Context
)
(
*
internalpb
.
ComponentStates
,
error
)
{
if
inm
.
Err
{
return
&
internalpb
.
ComponentStates
{
...
...
@@ -198,6 +205,7 @@ func (inm *Mock) GetComponentStates(ctx context.Context) (*internalpb.ComponentS
},
nil
}
// GetStatisticsChannel gets the statistics channel of the mocked IndexNode, if the internal member `Err` is true, it will return an error.
func
(
inm
*
Mock
)
GetStatisticsChannel
(
ctx
context
.
Context
)
(
*
milvuspb
.
StringResponse
,
error
)
{
if
inm
.
Err
{
return
&
milvuspb
.
StringResponse
{
...
...
@@ -214,6 +222,7 @@ func (inm *Mock) GetStatisticsChannel(ctx context.Context) (*milvuspb.StringResp
},
nil
}
// GetTimeTickChannel gets the time tick channel of the mocked IndexNode, if the internal member `Err` is true, it will return an error.
func
(
inm
*
Mock
)
GetTimeTickChannel
(
ctx
context
.
Context
)
(
*
milvuspb
.
StringResponse
,
error
)
{
if
inm
.
Err
{
return
&
milvuspb
.
StringResponse
{
...
...
@@ -230,6 +239,9 @@ func (inm *Mock) GetTimeTickChannel(ctx context.Context) (*milvuspb.StringRespon
},
nil
}
// CreateIndex receives a building index request, and return success, if the internal member `Build` is true,
// the indexing task will be executed. If the internal member `Err` is true, it will return an error.
// If the internal member `Failure` is true, the indexing task will be executed and the index state is Failed.
func
(
inm
*
Mock
)
CreateIndex
(
ctx
context
.
Context
,
req
*
indexpb
.
CreateIndexRequest
)
(
*
commonpb
.
Status
,
error
)
{
if
inm
.
Build
{
inm
.
buildIndex
<-
req
...
...
@@ -246,6 +258,7 @@ func (inm *Mock) CreateIndex(ctx context.Context, req *indexpb.CreateIndexReques
},
nil
}
// GetMetrics gets the metrics of mocked IndexNode, if the internal member `Failure` is true, it will return an error.
func
(
inm
*
Mock
)
GetMetrics
(
ctx
context
.
Context
,
req
*
milvuspb
.
GetMetricsRequest
)
(
*
milvuspb
.
GetMetricsResponse
,
error
)
{
if
inm
.
Err
{
return
&
milvuspb
.
GetMetricsResponse
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录