mirror of https://github.com/milvus-io/milvus.git
[skip ci]Fix golint in indexnode/client/client.go (#9121)
Signed-off-by: cai.zhang <cai.zhang@zilliz.com>pull/9119/head
parent
96823eb7db
commit
8f4a735676
|
@ -33,6 +33,7 @@ import (
|
|||
"github.com/milvus-io/milvus/internal/proto/internalpb"
|
||||
)
|
||||
|
||||
// Client is the grpc client of IndexNode.
|
||||
type Client struct {
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
|
@ -86,6 +87,7 @@ func (c *Client) resetConnection() {
|
|||
c.grpcClient = nil
|
||||
}
|
||||
|
||||
// NewClient creates a new IndexNode client.
|
||||
func NewClient(ctx context.Context, addr string) (*Client, error) {
|
||||
if addr == "" {
|
||||
return nil, fmt.Errorf("address is empty")
|
||||
|
@ -102,6 +104,7 @@ func NewClient(ctx context.Context, addr string) (*Client, error) {
|
|||
return client, nil
|
||||
}
|
||||
|
||||
// Init initializes IndexNode's grpc client.
|
||||
func (c *Client) Init() error {
|
||||
Params.Init()
|
||||
return nil
|
||||
|
@ -171,10 +174,12 @@ func (c *Client) recall(caller func() (interface{}, error)) (interface{}, error)
|
|||
return ret, err
|
||||
}
|
||||
|
||||
// Start starts IndexNode's client service. But it does nothing here.
|
||||
func (c *Client) Start() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Stop stops IndexNode's grpc client.
|
||||
func (c *Client) Stop() error {
|
||||
c.cancel()
|
||||
c.grpcClientMtx.Lock()
|
||||
|
@ -190,6 +195,7 @@ func (c *Client) Register() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// GetComponentStates gets the component states of IndexNode.
|
||||
func (c *Client) GetComponentStates(ctx context.Context) (*internalpb.ComponentStates, error) {
|
||||
ret, err := c.recall(func() (interface{}, error) {
|
||||
client, err := c.getGrpcClient()
|
||||
|
@ -205,6 +211,7 @@ func (c *Client) GetComponentStates(ctx context.Context) (*internalpb.ComponentS
|
|||
return ret.(*internalpb.ComponentStates), err
|
||||
}
|
||||
|
||||
// GetTimeTickChannel gets the time tick channel of IndexNode.
|
||||
func (c *Client) GetTimeTickChannel(ctx context.Context) (*milvuspb.StringResponse, error) {
|
||||
ret, err := c.recall(func() (interface{}, error) {
|
||||
client, err := c.getGrpcClient()
|
||||
|
@ -220,6 +227,7 @@ func (c *Client) GetTimeTickChannel(ctx context.Context) (*milvuspb.StringRespon
|
|||
return ret.(*milvuspb.StringResponse), err
|
||||
}
|
||||
|
||||
// GetStatisticsChannel gets the statistics channel of IndexNode.
|
||||
func (c *Client) GetStatisticsChannel(ctx context.Context) (*milvuspb.StringResponse, error) {
|
||||
ret, err := c.recall(func() (interface{}, error) {
|
||||
client, err := c.getGrpcClient()
|
||||
|
@ -235,6 +243,7 @@ func (c *Client) GetStatisticsChannel(ctx context.Context) (*milvuspb.StringResp
|
|||
return ret.(*milvuspb.StringResponse), err
|
||||
}
|
||||
|
||||
// CreateIndex sends the build index request to IndexNode.
|
||||
func (c *Client) CreateIndex(ctx context.Context, req *indexpb.CreateIndexRequest) (*commonpb.Status, error) {
|
||||
ret, err := c.recall(func() (interface{}, error) {
|
||||
client, err := c.getGrpcClient()
|
||||
|
@ -250,6 +259,7 @@ func (c *Client) CreateIndex(ctx context.Context, req *indexpb.CreateIndexReques
|
|||
return ret.(*commonpb.Status), err
|
||||
}
|
||||
|
||||
// GetMetrics gets the metrics info of IndexNode.
|
||||
func (c *Client) GetMetrics(ctx context.Context, req *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) {
|
||||
ret, err := c.recall(func() (interface{}, error) {
|
||||
client, err := c.getGrpcClient()
|
||||
|
|
Loading…
Reference in New Issue