From 8b8861f5b0676ddf501388c9d56bc65eb2197424 Mon Sep 17 00:00:00 2001 From: PowderLi Date: Tue, 5 Dec 2023 13:29:39 +0800 Subject: [PATCH] add corresponding permissions to apis 1. partition related apis 2. load related apis Signed-off-by: PowderLi --- go-api/milvuspb/milvus.pb.go | 46 ++++++++++++------------------------ go-api/schemapb/schema.pb.go | 11 ++++++--- proto/common.proto | 4 ++++ proto/milvus.proto | 40 +++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 34 deletions(-) diff --git a/go-api/milvuspb/milvus.pb.go b/go-api/milvuspb/milvus.pb.go index 55b074c..64c1694 100644 --- a/go-api/milvuspb/milvus.pb.go +++ b/go-api/milvuspb/milvus.pb.go @@ -376,7 +376,6 @@ func (m *DescribeAliasRequest) GetAlias() string { return "" } -// // Describe alias response type DescribeAliasResponse struct { // Response status @@ -497,7 +496,6 @@ func (m *ListAliasesRequest) GetCollectionName() string { return "" } -// // List aliases response type ListAliasesResponse struct { // Response status @@ -563,7 +561,7 @@ func (m *ListAliasesResponse) GetAliases() []string { return nil } -//* +// * // Create collection in milvus type CreateCollectionRequest struct { // Not useful for now @@ -666,7 +664,7 @@ func (m *CreateCollectionRequest) GetNumPartitions() int64 { return 0 } -//* +// * // Drop collection in milvus, also will drop data in collection. type DropCollectionRequest struct { // Not useful for now @@ -725,7 +723,7 @@ func (m *DropCollectionRequest) GetCollectionName() string { return "" } -//* +// * // Alter collection in milvus type AlterCollectionRequest struct { // Not useful for now @@ -800,7 +798,7 @@ func (m *AlterCollectionRequest) GetProperties() []*commonpb.KeyValuePair { return nil } -//* +// * // Check collection exist in milvus or not. type HasCollectionRequest struct { // Not useful for now @@ -962,7 +960,7 @@ func (m *StringResponse) GetValue() string { return "" } -//* +// * // Get collection meta datas like: schema, collectionID, shards number ... type DescribeCollectionRequest struct { // Not useful for now @@ -1039,7 +1037,7 @@ func (m *DescribeCollectionRequest) GetTimeStamp() uint64 { return 0 } -//* +// * // DescribeCollection Response type DescribeCollectionResponse struct { // Contain error_code and reason @@ -1204,7 +1202,7 @@ func (m *DescribeCollectionResponse) GetNumPartitions() int64 { return 0 } -//* +// * // Load collection data into query nodes, then you can do vector search on this collection. type LoadCollectionRequest struct { // Not useful for now @@ -1290,7 +1288,7 @@ func (m *LoadCollectionRequest) GetRefresh() bool { return false } -//* +// * // Release collection data from query nodes, then you can't do vector search on this collection. type ReleaseCollectionRequest struct { // Not useful for now @@ -1349,7 +1347,7 @@ func (m *ReleaseCollectionRequest) GetCollectionName() string { return "" } -//* +// * // Get statistics like row_count. // WARNING: This API is experimental and not useful for now. type GetStatisticsRequest struct { @@ -1427,7 +1425,7 @@ func (m *GetStatisticsRequest) GetGuaranteeTimestamp() uint64 { return 0 } -//* +// * // Will return statistics in stats field like [{key:"row_count",value:"1"}] // WARNING: This API is experimental and not useful for now. type GetStatisticsResponse struct { @@ -1479,7 +1477,7 @@ func (m *GetStatisticsResponse) GetStats() []*commonpb.KeyValuePair { return nil } -//* +// * // Get collection statistics like row_count. type GetCollectionStatisticsRequest struct { // Not useful for now @@ -1538,7 +1536,7 @@ func (m *GetCollectionStatisticsRequest) GetCollectionName() string { return "" } -//* +// * // Will return collection statistics in stats field like [{key:"row_count",value:"1"}] type GetCollectionStatisticsResponse struct { // Contain error_code and reason @@ -1589,7 +1587,6 @@ func (m *GetCollectionStatisticsResponse) GetStats() []*commonpb.KeyValuePair { return nil } -// // List collections type ShowCollectionsRequest struct { // Not useful for now @@ -1668,7 +1665,6 @@ func (m *ShowCollectionsRequest) GetCollectionNames() []string { return nil } -// // Return basic collection infos. type ShowCollectionsResponse struct { // Contain error_code and reason @@ -1766,7 +1762,6 @@ func (m *ShowCollectionsResponse) GetQueryServiceAvailable() []bool { return nil } -// // Create partition in created collection. type CreatePartitionRequest struct { // Not useful for now @@ -1834,7 +1829,6 @@ func (m *CreatePartitionRequest) GetPartitionName() string { return "" } -// // Drop partition in created collection. type DropPartitionRequest struct { // Not useful for now @@ -1902,7 +1896,6 @@ func (m *DropPartitionRequest) GetPartitionName() string { return "" } -// // Check if partition exist in collection or not. type HasPartitionRequest struct { // Not useful for now @@ -1970,7 +1963,6 @@ func (m *HasPartitionRequest) GetPartitionName() string { return "" } -// // Load specific partitions data of one collection into query nodes // Then you can get these data as result when you do vector search on this collection. type LoadPartitionsRequest struct { @@ -2066,7 +2058,6 @@ func (m *LoadPartitionsRequest) GetRefresh() bool { return false } -// // Release specific partitions data of one collection from query nodes. // Then you can not get these data as result when you do vector search on this collection. type ReleasePartitionsRequest struct { @@ -2135,7 +2126,6 @@ func (m *ReleasePartitionsRequest) GetPartitionNames() []string { return nil } -// // Get partition statistics like row_count. type GetPartitionStatisticsRequest struct { // Not useful for now @@ -2250,7 +2240,6 @@ func (m *GetPartitionStatisticsResponse) GetStats() []*commonpb.KeyValuePair { return nil } -// // List all partitions for particular collection type ShowPartitionsRequest struct { // Not useful for now @@ -2338,7 +2327,6 @@ func (m *ShowPartitionsRequest) GetType() ShowType { return ShowType_All } -// // List all partitions for particular collection response. // The returned datas are all rows, we can format to columns by therir index. type ShowPartitionsResponse struct { @@ -2656,7 +2644,6 @@ func (m *ShowSegmentsResponse) GetSegmentIDs() []int64 { return nil } -// // Create index for vector datas type CreateIndexRequest struct { // Not useful for now @@ -2742,7 +2729,6 @@ func (m *CreateIndexRequest) GetIndexName() string { return "" } -// // Get created index information. // Current release of Milvus only supports showing latest built index. type DescribeIndexRequest struct { @@ -2828,7 +2814,6 @@ func (m *DescribeIndexRequest) GetTimestamp() uint64 { return 0 } -// // Index informations type IndexDescription struct { // Index name @@ -2939,7 +2924,6 @@ func (m *IndexDescription) GetPendingIndexRows() int64 { return 0 } -// // Describe index response type DescribeIndexResponse struct { // Response status @@ -2990,8 +2974,7 @@ func (m *DescribeIndexResponse) GetIndexDescriptions() []*IndexDescription { return nil } -// -// Get index building progress +// Get index building progress type GetIndexBuildProgressRequest struct { // Not useful for now Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"` @@ -4335,6 +4318,7 @@ func (m *VectorIDs) GetPartitionNames() []string { type VectorsArray struct { // Types that are valid to be assigned to Array: + // // *VectorsArray_IdArray // *VectorsArray_DataArray Array isVectorsArray_Array `protobuf_oneof:"array"` @@ -4481,6 +4465,7 @@ type CalcDistanceResults struct { // num(op_left)*num(op_right) distance values, "HAMMIN" return integer distance // // Types that are valid to be assigned to Array: + // // *CalcDistanceResults_IntDist // *CalcDistanceResults_FloatDist Array isCalcDistanceResults_Array `protobuf_oneof:"array"` @@ -5455,7 +5440,6 @@ func (m *GetComponentStatesRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetComponentStatesRequest proto.InternalMessageInfo -// // Do load balancing operation from src_nodeID to dst_nodeID. type LoadBalanceRequest struct { Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"` diff --git a/go-api/schemapb/schema.pb.go b/go-api/schemapb/schema.pb.go index c65fb7c..2d35cfb 100644 --- a/go-api/schemapb/schema.pb.go +++ b/go-api/schemapb/schema.pb.go @@ -22,7 +22,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -//* +// * // @brief Field data type type DataType int32 @@ -122,7 +122,7 @@ func (FieldState) EnumDescriptor() ([]byte, []int) { return fileDescriptor_1c5fb4d8cc22d66a, []int{1} } -//* +// * // @brief Field schema type FieldSchema struct { FieldID int64 `protobuf:"varint,1,opt,name=fieldID,proto3" json:"fieldID,omitempty"` @@ -260,7 +260,7 @@ func (m *FieldSchema) GetIsPartitionKey() bool { return false } -//* +// * // @brief Collection schema type CollectionSchema struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` @@ -696,6 +696,7 @@ func (m *JSONArray) GetData() [][]byte { type ValueField struct { // Types that are valid to be assigned to Data: + // // *ValueField_BoolData // *ValueField_IntData // *ValueField_LongData @@ -851,6 +852,7 @@ func (*ValueField) XXX_OneofWrappers() []interface{} { type ScalarField struct { // Types that are valid to be assigned to Data: + // // *ScalarField_BoolData // *ScalarField_IntData // *ScalarField_LongData @@ -1037,6 +1039,7 @@ func (*ScalarField) XXX_OneofWrappers() []interface{} { type VectorField struct { Dim int64 `protobuf:"varint,1,opt,name=dim,proto3" json:"dim,omitempty"` // Types that are valid to be assigned to Data: + // // *VectorField_FloatVector // *VectorField_BinaryVector // *VectorField_Float16Vector @@ -1156,6 +1159,7 @@ type FieldData struct { Type DataType `protobuf:"varint,1,opt,name=type,proto3,enum=milvus.proto.schema.DataType" json:"type,omitempty"` FieldName string `protobuf:"bytes,2,opt,name=field_name,json=fieldName,proto3" json:"field_name,omitempty"` // Types that are valid to be assigned to Field: + // // *FieldData_Scalars // *FieldData_Vectors Field isFieldData_Field `protobuf_oneof:"field"` @@ -1266,6 +1270,7 @@ func (*FieldData) XXX_OneofWrappers() []interface{} { type IDs struct { // Types that are valid to be assigned to IdField: + // // *IDs_IntId // *IDs_StrId IdField isIDs_IdField `protobuf_oneof:"id_field"` diff --git a/proto/common.proto b/proto/common.proto index 69f1721..86542cb 100644 --- a/proto/common.proto +++ b/proto/common.proto @@ -381,6 +381,10 @@ enum ObjectPrivilege { PrivilegeDropDatabase = 36; PrivilegeListDatabases = 37; PrivilegeFlushAll = 38; + + PrivilegeCreatePartition = 39; + PrivilegeDropPartition = 40; + PrivilegeShowPartitions = 41; } message PrivilegeExt { diff --git a/proto/milvus.proto b/proto/milvus.proto index 2c37bb6..493e44f 100644 --- a/proto/milvus.proto +++ b/proto/milvus.proto @@ -476,6 +476,11 @@ message ShowCollectionsResponse { * Create partition in created collection. */ message CreatePartitionRequest { + option (common.privilege_ext_obj) = { + object_type: Collection + object_privilege: PrivilegeCreatePartition + object_name_index: 3 + }; // Not useful for now common.MsgBase base = 1; string db_name = 2; @@ -489,6 +494,11 @@ message CreatePartitionRequest { * Drop partition in created collection. */ message DropPartitionRequest { + option (common.privilege_ext_obj) = { + object_type: Collection + object_privilege: PrivilegeDropPartition + object_name_index: 3 + }; // Not useful for now common.MsgBase base = 1; string db_name = 2; @@ -516,6 +526,11 @@ message HasPartitionRequest { * Then you can get these data as result when you do vector search on this collection. */ message LoadPartitionsRequest { + option (common.privilege_ext_obj) = { + object_type: Collection + object_privilege: PrivilegeLoad + object_name_index: 3 + }; // Not useful for now common.MsgBase base = 1; string db_name = 2; @@ -536,6 +551,11 @@ message LoadPartitionsRequest { * Then you can not get these data as result when you do vector search on this collection. */ message ReleasePartitionsRequest { + option (common.privilege_ext_obj) = { + object_type: Collection + object_privilege: PrivilegeRelease + object_name_index: 3 + }; // Not useful for now common.MsgBase base = 1; string db_name = 2; @@ -549,6 +569,11 @@ message ReleasePartitionsRequest { * Get partition statistics like row_count. */ message GetPartitionStatisticsRequest { + option (common.privilege_ext_obj) = { + object_type: Collection + object_privilege: PrivilegeGetStatistics + object_name_index: 3 + }; // Not useful for now common.MsgBase base = 1; string db_name = 2; @@ -567,6 +592,11 @@ message GetPartitionStatisticsResponse { * List all partitions for particular collection */ message ShowPartitionsRequest { + option (common.privilege_ext_obj) = { + object_type: Collection + object_privilege: PrivilegeShowPartitions + object_name_index: 3 + }; // Not useful for now common.MsgBase base = 1; string db_name = 2; @@ -1115,6 +1145,11 @@ message CompactionMergeInfo { } message GetFlushStateRequest { + option (common.privilege_ext_obj) = { + object_type: Collection + object_privilege: PrivilegeFlush + object_name_indexs: 4 + }; repeated int64 segmentIDs = 1; uint64 flush_ts = 2; string db_name = 3; @@ -1127,6 +1162,11 @@ message GetFlushStateResponse { } message GetFlushAllStateRequest { + option (common.privilege_ext_obj) = { + object_type: Collection + object_privilege: PrivilegeFlush + object_name_indexs: -1 + }; common.MsgBase base = 1; uint64 flush_all_ts = 2; string db_name = 3;