2021-01-26 07:13:20 +00:00
|
|
|
package queryservice
|
|
|
|
|
|
|
|
import (
|
2021-02-26 09:44:24 +00:00
|
|
|
"context"
|
|
|
|
|
2021-01-26 07:13:20 +00:00
|
|
|
"github.com/zilliztech/milvus-distributed/internal/proto/commonpb"
|
|
|
|
"github.com/zilliztech/milvus-distributed/internal/proto/internalpb2"
|
|
|
|
"github.com/zilliztech/milvus-distributed/internal/proto/querypb"
|
|
|
|
)
|
|
|
|
|
2021-02-02 03:52:41 +00:00
|
|
|
type queryNodeInfo struct {
|
2021-01-26 07:13:20 +00:00
|
|
|
client QueryNodeInterface
|
|
|
|
segments []UniqueID
|
2021-02-02 03:52:41 +00:00
|
|
|
dmChannelNames []string
|
2021-01-26 07:13:20 +00:00
|
|
|
}
|
|
|
|
|
2021-02-26 09:44:24 +00:00
|
|
|
func (qn *queryNodeInfo) GetComponentStates(ctx context.Context) (*internalpb2.ComponentStates, error) {
|
|
|
|
return qn.client.GetComponentStates(ctx)
|
2021-01-26 07:13:20 +00:00
|
|
|
}
|
|
|
|
|
2021-02-26 09:44:24 +00:00
|
|
|
func (qn *queryNodeInfo) LoadSegments(ctx context.Context, in *querypb.LoadSegmentRequest) (*commonpb.Status, error) {
|
|
|
|
return qn.client.LoadSegments(ctx, in)
|
2021-01-26 07:13:20 +00:00
|
|
|
}
|
2021-02-04 03:40:14 +00:00
|
|
|
|
2021-02-26 09:44:24 +00:00
|
|
|
func (qn *queryNodeInfo) GetSegmentInfo(ctx context.Context, in *querypb.SegmentInfoRequest) (*querypb.SegmentInfoResponse, error) {
|
|
|
|
return qn.client.GetSegmentInfo(ctx, in)
|
2021-02-04 03:40:14 +00:00
|
|
|
}
|
2021-02-04 09:47:19 +00:00
|
|
|
|
2021-02-26 09:44:24 +00:00
|
|
|
func (qn *queryNodeInfo) WatchDmChannels(ctx context.Context, in *querypb.WatchDmChannelsRequest) (*commonpb.Status, error) {
|
|
|
|
return qn.client.WatchDmChannels(ctx, in)
|
2021-02-04 09:47:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (qn *queryNodeInfo) AddDmChannels(channels []string) {
|
|
|
|
qn.dmChannelNames = append(qn.dmChannelNames, channels...)
|
|
|
|
}
|
|
|
|
|
2021-02-26 09:44:24 +00:00
|
|
|
func (qn *queryNodeInfo) AddQueryChannel(ctx context.Context, in *querypb.AddQueryChannelsRequest) (*commonpb.Status, error) {
|
|
|
|
return qn.client.AddQueryChannel(ctx, in)
|
2021-02-09 09:09:26 +00:00
|
|
|
}
|
|
|
|
|
2021-02-26 09:44:24 +00:00
|
|
|
func (qn *queryNodeInfo) ReleaseCollection(ctx context.Context, in *querypb.ReleaseCollectionRequest) (*commonpb.Status, error) {
|
|
|
|
return qn.client.ReleaseCollection(ctx, in)
|
2021-02-24 09:24:51 +00:00
|
|
|
}
|
|
|
|
|
2021-02-26 09:44:24 +00:00
|
|
|
func (qn *queryNodeInfo) ReleasePartitions(ctx context.Context, in *querypb.ReleasePartitionRequest) (*commonpb.Status, error) {
|
|
|
|
return qn.client.ReleasePartitions(ctx, in)
|
2021-02-24 09:24:51 +00:00
|
|
|
}
|
|
|
|
|
2021-02-04 09:47:19 +00:00
|
|
|
func newQueryNodeInfo(client QueryNodeInterface) *queryNodeInfo {
|
|
|
|
segments := make([]UniqueID, 0)
|
|
|
|
dmChannelNames := make([]string, 0)
|
|
|
|
return &queryNodeInfo{
|
|
|
|
client: client,
|
|
|
|
segments: segments,
|
|
|
|
dmChannelNames: dmChannelNames,
|
|
|
|
}
|
|
|
|
}
|