2021-04-19 15:15:33 +08:00
|
|
|
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
|
|
|
|
// with the License. You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
|
|
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
|
|
// or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
|
|
|
2021-03-05 15:21:33 +08:00
|
|
|
package types
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2021-04-22 14:45:57 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/proto/commonpb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/datapb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/indexpb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/internalpb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/masterpb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/milvuspb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/proxypb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/querypb"
|
2021-05-26 20:14:30 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/util/sessionutil"
|
2021-03-05 15:21:33 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
type TimeTickProvider interface {
|
|
|
|
GetTimeTickChannel(ctx context.Context) (*milvuspb.StringResponse, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type Component interface {
|
|
|
|
Init() error
|
|
|
|
Start() error
|
|
|
|
Stop() error
|
2021-03-12 14:22:09 +08:00
|
|
|
GetComponentStates(ctx context.Context) (*internalpb.ComponentStates, error)
|
2021-03-05 15:21:33 +08:00
|
|
|
GetStatisticsChannel(ctx context.Context) (*milvuspb.StringResponse, error)
|
2021-05-25 15:06:05 +08:00
|
|
|
Register() error
|
2021-03-05 15:21:33 +08:00
|
|
|
}
|
|
|
|
|
2021-03-05 18:14:59 +08:00
|
|
|
type DataNode interface {
|
2021-03-05 15:21:33 +08:00
|
|
|
Component
|
|
|
|
|
2021-03-12 14:22:09 +08:00
|
|
|
WatchDmChannels(ctx context.Context, req *datapb.WatchDmChannelsRequest) (*commonpb.Status, error)
|
|
|
|
FlushSegments(ctx context.Context, req *datapb.FlushSegmentsRequest) (*commonpb.Status, error)
|
2021-03-05 15:21:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type DataService interface {
|
|
|
|
Component
|
|
|
|
TimeTickProvider
|
|
|
|
|
|
|
|
RegisterNode(ctx context.Context, req *datapb.RegisterNodeRequest) (*datapb.RegisterNodeResponse, error)
|
|
|
|
Flush(ctx context.Context, req *datapb.FlushRequest) (*commonpb.Status, error)
|
|
|
|
|
2021-03-12 14:22:09 +08:00
|
|
|
AssignSegmentID(ctx context.Context, req *datapb.AssignSegmentIDRequest) (*datapb.AssignSegmentIDResponse, error)
|
|
|
|
ShowSegments(ctx context.Context, req *datapb.ShowSegmentsRequest) (*datapb.ShowSegmentsResponse, error)
|
|
|
|
GetSegmentStates(ctx context.Context, req *datapb.GetSegmentStatesRequest) (*datapb.GetSegmentStatesResponse, error)
|
|
|
|
GetInsertBinlogPaths(ctx context.Context, req *datapb.GetInsertBinlogPathsRequest) (*datapb.GetInsertBinlogPathsResponse, error)
|
2021-03-05 15:21:33 +08:00
|
|
|
GetSegmentInfoChannel(ctx context.Context) (*milvuspb.StringResponse, error)
|
2021-03-12 14:22:09 +08:00
|
|
|
GetInsertChannels(ctx context.Context, req *datapb.GetInsertChannelsRequest) (*internalpb.StringList, error)
|
|
|
|
GetCollectionStatistics(ctx context.Context, req *datapb.GetCollectionStatisticsRequest) (*datapb.GetCollectionStatisticsResponse, error)
|
|
|
|
GetPartitionStatistics(ctx context.Context, req *datapb.GetPartitionStatisticsRequest) (*datapb.GetPartitionStatisticsResponse, error)
|
|
|
|
GetSegmentInfo(ctx context.Context, req *datapb.GetSegmentInfoRequest) (*datapb.GetSegmentInfoResponse, error)
|
2021-06-07 14:16:36 +08:00
|
|
|
GetRecoveryInfo(ctx context.Context, req *datapb.GetRecoveryInfoRequest) (*datapb.GetRecoveryInfoResponse, error)
|
2021-03-05 15:21:33 +08:00
|
|
|
}
|
|
|
|
|
2021-03-05 18:14:59 +08:00
|
|
|
type IndexNode interface {
|
2021-03-05 15:21:33 +08:00
|
|
|
Component
|
|
|
|
TimeTickProvider
|
|
|
|
|
2021-05-27 22:24:29 +08:00
|
|
|
CreateIndex(ctx context.Context, req *indexpb.CreateIndexRequest) (*commonpb.Status, error)
|
2021-03-05 15:21:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type IndexService interface {
|
|
|
|
Component
|
|
|
|
TimeTickProvider
|
|
|
|
|
|
|
|
RegisterNode(ctx context.Context, req *indexpb.RegisterNodeRequest) (*indexpb.RegisterNodeResponse, error)
|
|
|
|
BuildIndex(ctx context.Context, req *indexpb.BuildIndexRequest) (*indexpb.BuildIndexResponse, error)
|
|
|
|
DropIndex(ctx context.Context, req *indexpb.DropIndexRequest) (*commonpb.Status, error)
|
2021-03-12 14:22:09 +08:00
|
|
|
GetIndexStates(ctx context.Context, req *indexpb.GetIndexStatesRequest) (*indexpb.GetIndexStatesResponse, error)
|
|
|
|
GetIndexFilePaths(ctx context.Context, req *indexpb.GetIndexFilePathsRequest) (*indexpb.GetIndexFilePathsResponse, error)
|
2021-03-05 15:21:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type MasterService interface {
|
|
|
|
Component
|
2021-04-24 17:23:35 +08:00
|
|
|
TimeTickProvider
|
2021-03-05 15:21:33 +08:00
|
|
|
|
|
|
|
//DDL request
|
2021-03-12 14:22:09 +08:00
|
|
|
CreateCollection(ctx context.Context, req *milvuspb.CreateCollectionRequest) (*commonpb.Status, error)
|
|
|
|
DropCollection(ctx context.Context, req *milvuspb.DropCollectionRequest) (*commonpb.Status, error)
|
|
|
|
HasCollection(ctx context.Context, req *milvuspb.HasCollectionRequest) (*milvuspb.BoolResponse, error)
|
|
|
|
DescribeCollection(ctx context.Context, req *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error)
|
|
|
|
ShowCollections(ctx context.Context, req *milvuspb.ShowCollectionsRequest) (*milvuspb.ShowCollectionsResponse, error)
|
|
|
|
CreatePartition(ctx context.Context, req *milvuspb.CreatePartitionRequest) (*commonpb.Status, error)
|
|
|
|
DropPartition(ctx context.Context, req *milvuspb.DropPartitionRequest) (*commonpb.Status, error)
|
|
|
|
HasPartition(ctx context.Context, req *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error)
|
|
|
|
ShowPartitions(ctx context.Context, req *milvuspb.ShowPartitionsRequest) (*milvuspb.ShowPartitionsResponse, error)
|
2021-03-05 15:21:33 +08:00
|
|
|
|
|
|
|
//index builder service
|
2021-03-12 14:22:09 +08:00
|
|
|
CreateIndex(ctx context.Context, req *milvuspb.CreateIndexRequest) (*commonpb.Status, error)
|
|
|
|
DescribeIndex(ctx context.Context, req *milvuspb.DescribeIndexRequest) (*milvuspb.DescribeIndexResponse, error)
|
|
|
|
DropIndex(ctx context.Context, req *milvuspb.DropIndexRequest) (*commonpb.Status, error)
|
2021-03-05 15:21:33 +08:00
|
|
|
|
|
|
|
//global timestamp allocator
|
2021-03-12 14:22:09 +08:00
|
|
|
AllocTimestamp(ctx context.Context, req *masterpb.AllocTimestampRequest) (*masterpb.AllocTimestampResponse, error)
|
|
|
|
AllocID(ctx context.Context, req *masterpb.AllocIDRequest) (*masterpb.AllocIDResponse, error)
|
2021-05-21 16:08:12 +08:00
|
|
|
UpdateChannelTimeTick(ctx context.Context, req *internalpb.ChannelTimeTickMsg) (*commonpb.Status, error)
|
2021-03-05 15:21:33 +08:00
|
|
|
|
2021-03-12 14:22:09 +08:00
|
|
|
//segment
|
|
|
|
DescribeSegment(ctx context.Context, req *milvuspb.DescribeSegmentRequest) (*milvuspb.DescribeSegmentResponse, error)
|
|
|
|
ShowSegments(ctx context.Context, req *milvuspb.ShowSegmentsRequest) (*milvuspb.ShowSegmentsResponse, error)
|
2021-03-05 15:21:33 +08:00
|
|
|
|
|
|
|
GetDdChannel(ctx context.Context) (*milvuspb.StringResponse, error)
|
|
|
|
}
|
|
|
|
|
2021-04-24 17:23:35 +08:00
|
|
|
// MasterComponent is used by grpc server of master service
|
|
|
|
type MasterComponent interface {
|
|
|
|
MasterService
|
|
|
|
|
|
|
|
UpdateStateCode(internalpb.StateCode)
|
|
|
|
SetProxyService(context.Context, ProxyService) error
|
|
|
|
SetDataService(context.Context, DataService) error
|
|
|
|
SetIndexService(IndexService) error
|
|
|
|
SetQueryService(QueryService) error
|
2021-05-26 20:14:30 +08:00
|
|
|
SetNewProxyClient(func(sess *sessionutil.Session) (ProxyNode, error))
|
2021-04-24 17:23:35 +08:00
|
|
|
}
|
|
|
|
|
2021-03-05 18:14:59 +08:00
|
|
|
type ProxyNode interface {
|
2021-03-05 15:21:33 +08:00
|
|
|
Component
|
|
|
|
|
|
|
|
InvalidateCollectionMetaCache(ctx context.Context, request *proxypb.InvalidateCollMetaCacheRequest) (*commonpb.Status, error)
|
|
|
|
|
2021-03-05 18:14:59 +08:00
|
|
|
//TODO: move to milvus service
|
|
|
|
/*
|
|
|
|
CreateCollection(ctx context.Context, request *milvuspb.CreateCollectionRequest) (*commonpb.Status, error)
|
|
|
|
DropCollection(ctx context.Context, request *milvuspb.DropCollectionRequest) (*commonpb.Status, error)
|
|
|
|
HasCollection(ctx context.Context, request *milvuspb.HasCollectionRequest) (*milvuspb.BoolResponse, error)
|
|
|
|
LoadCollection(ctx context.Context, request *milvuspb.LoadCollectionRequest) (*commonpb.Status, error)
|
|
|
|
ReleaseCollection(ctx context.Context, request *milvuspb.ReleaseCollectionRequest) (*commonpb.Status, error)
|
|
|
|
DescribeCollection(ctx context.Context, request *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error)
|
2021-03-12 14:22:09 +08:00
|
|
|
GetCollectionStatistics(ctx context.Context, request *milvuspb.GetCollectionStatisticsRequest) (*milvuspb.GetCollectionStatisticsResponse, error)
|
|
|
|
ShowCollections(ctx context.Context, request *milvuspb.ShowCollectionsRequest) (*milvuspb.ShowCollectionsResponse, error)
|
2021-03-05 18:14:59 +08:00
|
|
|
|
|
|
|
CreatePartition(ctx context.Context, request *milvuspb.CreatePartitionRequest) (*commonpb.Status, error)
|
|
|
|
DropPartition(ctx context.Context, request *milvuspb.DropPartitionRequest) (*commonpb.Status, error)
|
|
|
|
HasPartition(ctx context.Context, request *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error)
|
2021-03-12 14:22:09 +08:00
|
|
|
LoadPartitions(ctx context.Context, request *milvuspb.LoadPartitionsRequest) (*commonpb.Status, error)
|
|
|
|
ReleasePartitions(ctx context.Context, request *milvuspb.ReleasePartitionsRequest) (*commonpb.Status, error)
|
|
|
|
GetPartitionStatistics(ctx context.Context, request *milvuspb.GetPartitionStatsRequest) (*milvuspb.GetPartitionStatisticsResponse, error)
|
|
|
|
ShowPartitions(ctx context.Context, request *milvuspb.ShowPartitionsRequest) (*milvuspb.ShowPartitionsResponse, error)
|
2021-03-05 18:14:59 +08:00
|
|
|
|
|
|
|
CreateIndex(ctx context.Context, request *milvuspb.CreateIndexRequest) (*commonpb.Status, error)
|
|
|
|
DescribeIndex(ctx context.Context, request *milvuspb.DescribeIndexRequest) (*milvuspb.DescribeIndexResponse, error)
|
2021-03-12 14:22:09 +08:00
|
|
|
GetIndexState(ctx context.Context, request *milvuspb.GetIndexStateRequest) (*milvuspb.GetIndexStateResponse, error)
|
2021-03-05 18:14:59 +08:00
|
|
|
DropIndex(ctx context.Context, request *milvuspb.DropIndexRequest) (*commonpb.Status, error)
|
|
|
|
|
|
|
|
Insert(ctx context.Context, request *milvuspb.InsertRequest) (*milvuspb.InsertResponse, error)
|
|
|
|
Search(ctx context.Context, request *milvuspb.SearchRequest) (*milvuspb.SearchResults, error)
|
|
|
|
Flush(ctx context.Context, request *milvuspb.FlushRequest) (*commonpb.Status, error)
|
|
|
|
|
|
|
|
GetDdChannel(ctx context.Context, request *commonpb.Empty) (*milvuspb.StringResponse, error)
|
|
|
|
|
2021-03-12 14:22:09 +08:00
|
|
|
GetQuerySegmentInfo(ctx context.Context, req *milvuspb.GetQuerySegmentInfoRequest) (*milvuspb.GetQuerySegmentInfoResponse, error)
|
|
|
|
GetPersistentSegmentInfo(ctx context.Context, req *milvuspb.GetPersistentSegmentInfoRequest) (*milvuspb.GetPersistentSegmentInfoResponse, error)
|
2021-03-05 18:14:59 +08:00
|
|
|
*/
|
2021-03-05 15:21:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type ProxyService interface {
|
|
|
|
Component
|
|
|
|
TimeTickProvider
|
|
|
|
|
2021-03-12 14:22:09 +08:00
|
|
|
RegisterNode(ctx context.Context, req *proxypb.RegisterNodeRequest) (*proxypb.RegisterNodeResponse, error)
|
|
|
|
InvalidateCollectionMetaCache(ctx context.Context, req *proxypb.InvalidateCollMetaCacheRequest) (*commonpb.Status, error)
|
2021-03-05 15:21:33 +08:00
|
|
|
}
|
|
|
|
|
2021-03-05 18:14:59 +08:00
|
|
|
type QueryNode interface {
|
2021-03-05 15:21:33 +08:00
|
|
|
Component
|
|
|
|
TimeTickProvider
|
|
|
|
|
2021-03-12 14:22:09 +08:00
|
|
|
AddQueryChannel(ctx context.Context, req *querypb.AddQueryChannelRequest) (*commonpb.Status, error)
|
|
|
|
RemoveQueryChannel(ctx context.Context, req *querypb.RemoveQueryChannelRequest) (*commonpb.Status, error)
|
|
|
|
WatchDmChannels(ctx context.Context, req *querypb.WatchDmChannelsRequest) (*commonpb.Status, error)
|
|
|
|
LoadSegments(ctx context.Context, req *querypb.LoadSegmentsRequest) (*commonpb.Status, error)
|
|
|
|
ReleaseCollection(ctx context.Context, req *querypb.ReleaseCollectionRequest) (*commonpb.Status, error)
|
|
|
|
ReleasePartitions(ctx context.Context, req *querypb.ReleasePartitionsRequest) (*commonpb.Status, error)
|
|
|
|
ReleaseSegments(ctx context.Context, req *querypb.ReleaseSegmentsRequest) (*commonpb.Status, error)
|
|
|
|
GetSegmentInfo(ctx context.Context, req *querypb.GetSegmentInfoRequest) (*querypb.GetSegmentInfoResponse, error)
|
2021-03-05 15:21:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type QueryService interface {
|
|
|
|
Component
|
|
|
|
TimeTickProvider
|
|
|
|
|
2021-03-08 10:09:48 +08:00
|
|
|
RegisterNode(ctx context.Context, req *querypb.RegisterNodeRequest) (*querypb.RegisterNodeResponse, error)
|
2021-03-12 14:22:09 +08:00
|
|
|
ShowCollections(ctx context.Context, req *querypb.ShowCollectionsRequest) (*querypb.ShowCollectionsResponse, error)
|
2021-03-05 15:21:33 +08:00
|
|
|
LoadCollection(ctx context.Context, req *querypb.LoadCollectionRequest) (*commonpb.Status, error)
|
|
|
|
ReleaseCollection(ctx context.Context, req *querypb.ReleaseCollectionRequest) (*commonpb.Status, error)
|
2021-03-12 14:22:09 +08:00
|
|
|
ShowPartitions(ctx context.Context, req *querypb.ShowPartitionsRequest) (*querypb.ShowPartitionsResponse, error)
|
|
|
|
LoadPartitions(ctx context.Context, req *querypb.LoadPartitionsRequest) (*commonpb.Status, error)
|
|
|
|
ReleasePartitions(ctx context.Context, req *querypb.ReleasePartitionsRequest) (*commonpb.Status, error)
|
2021-06-15 12:41:40 +08:00
|
|
|
CreateQueryChannel(ctx context.Context, req *querypb.CreateQueryChannelRequest) (*querypb.CreateQueryChannelResponse, error)
|
2021-03-12 14:22:09 +08:00
|
|
|
GetPartitionStates(ctx context.Context, req *querypb.GetPartitionStatesRequest) (*querypb.GetPartitionStatesResponse, error)
|
|
|
|
GetSegmentInfo(ctx context.Context, req *querypb.GetSegmentInfoRequest) (*querypb.GetSegmentInfoResponse, error)
|
2021-03-05 15:21:33 +08:00
|
|
|
}
|