mirror of https://github.com/milvus-io/milvus.git
Update the collection proto and add the go files generated by proto
Signed-off-by: rain <boyan.wang@zilliz.com>pull/4973/head^2
parent
be35568af1
commit
c10cf9bf8f
|
@ -0,0 +1,3 @@
|
|||
master-proto-gen:
|
||||
protoc --go_out=plugins=grpc,paths=source_relative:. pkg/master/grpc/master/master.proto
|
||||
protoc --go_out=plugins=grpc,paths=source_relative:. pkg/master/grpc/message/message.proto
|
|
@ -1,235 +0,0 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: master.proto
|
||||
|
||||
//option go_package = "github.com/czs007/suvilm/pkg/master/grpc";
|
||||
|
||||
package masterpb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type CreateCollectionRequest struct {
|
||||
CollectionName string `protobuf:"bytes,1,opt,name=collection_name,json=collectionName,proto3" json:"collection_name,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *CreateCollectionRequest) Reset() { *m = CreateCollectionRequest{} }
|
||||
func (m *CreateCollectionRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateCollectionRequest) ProtoMessage() {}
|
||||
func (*CreateCollectionRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f9c348dec43a6705, []int{0}
|
||||
}
|
||||
|
||||
func (m *CreateCollectionRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_CreateCollectionRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *CreateCollectionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_CreateCollectionRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *CreateCollectionRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_CreateCollectionRequest.Merge(m, src)
|
||||
}
|
||||
func (m *CreateCollectionRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_CreateCollectionRequest.Size(m)
|
||||
}
|
||||
func (m *CreateCollectionRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_CreateCollectionRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_CreateCollectionRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *CreateCollectionRequest) GetCollectionName() string {
|
||||
if m != nil {
|
||||
return m.CollectionName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CreateCollectionResponse struct {
|
||||
CollectionName string `protobuf:"bytes,1,opt,name=collection_name,json=collectionName,proto3" json:"collection_name,omitempty"`
|
||||
CollectionId uint64 `protobuf:"varint,2,opt,name=collection_id,json=collectionId,proto3" json:"collection_id,omitempty"`
|
||||
SegmentIds []uint64 `protobuf:"varint,3,rep,packed,name=segment_ids,json=segmentIds,proto3" json:"segment_ids,omitempty"`
|
||||
PartitionTags []string `protobuf:"bytes,4,rep,name=partition_tags,json=partitionTags,proto3" json:"partition_tags,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *CreateCollectionResponse) Reset() { *m = CreateCollectionResponse{} }
|
||||
func (m *CreateCollectionResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateCollectionResponse) ProtoMessage() {}
|
||||
func (*CreateCollectionResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f9c348dec43a6705, []int{1}
|
||||
}
|
||||
|
||||
func (m *CreateCollectionResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_CreateCollectionResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *CreateCollectionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_CreateCollectionResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *CreateCollectionResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_CreateCollectionResponse.Merge(m, src)
|
||||
}
|
||||
func (m *CreateCollectionResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_CreateCollectionResponse.Size(m)
|
||||
}
|
||||
func (m *CreateCollectionResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_CreateCollectionResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_CreateCollectionResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *CreateCollectionResponse) GetCollectionName() string {
|
||||
if m != nil {
|
||||
return m.CollectionName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CreateCollectionResponse) GetCollectionId() uint64 {
|
||||
if m != nil {
|
||||
return m.CollectionId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *CreateCollectionResponse) GetSegmentIds() []uint64 {
|
||||
if m != nil {
|
||||
return m.SegmentIds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateCollectionResponse) GetPartitionTags() []string {
|
||||
if m != nil {
|
||||
return m.PartitionTags
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*CreateCollectionRequest)(nil), "masterpb.CreateCollectionRequest")
|
||||
proto.RegisterType((*CreateCollectionResponse)(nil), "masterpb.CreateCollectionResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("master.proto", fileDescriptor_f9c348dec43a6705) }
|
||||
|
||||
var fileDescriptor_f9c348dec43a6705 = []byte{
|
||||
// 225 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0xcf, 0x4a, 0x03, 0x31,
|
||||
0x10, 0x87, 0x5d, 0x77, 0x29, 0x76, 0x6c, 0xab, 0xe4, 0x62, 0xf0, 0xe2, 0x1a, 0x11, 0x73, 0xda,
|
||||
0x83, 0xbe, 0x81, 0x3d, 0xf5, 0xa0, 0x87, 0xe0, 0xcd, 0x43, 0x49, 0x9b, 0x61, 0x09, 0x34, 0x7f,
|
||||
0xcc, 0x8c, 0xef, 0xe5, 0x23, 0x0a, 0x5b, 0x6d, 0x45, 0x51, 0x3c, 0xe6, 0xe3, 0xc7, 0x47, 0xe6,
|
||||
0x83, 0x49, 0xb0, 0xc4, 0x58, 0xba, 0x5c, 0x12, 0x27, 0x71, 0xb4, 0x7d, 0xe5, 0x95, 0xba, 0x87,
|
||||
0xb3, 0x79, 0x41, 0xcb, 0x38, 0x4f, 0x9b, 0x0d, 0xae, 0xd9, 0xa7, 0x68, 0xf0, 0xe5, 0x15, 0x89,
|
||||
0xc5, 0x0d, 0x9c, 0xac, 0x77, 0x70, 0x19, 0x6d, 0x40, 0x59, 0xb5, 0x95, 0x1e, 0x9b, 0xd9, 0x1e,
|
||||
0x3f, 0xda, 0x80, 0xea, 0xad, 0x02, 0xf9, 0x53, 0x42, 0x39, 0x45, 0xc2, 0x7f, 0x5b, 0xc4, 0x15,
|
||||
0x4c, 0xbf, 0x0c, 0xbd, 0x93, 0x87, 0x6d, 0xa5, 0x1b, 0x33, 0xd9, 0xc3, 0x85, 0x13, 0x17, 0x70,
|
||||
0x4c, 0xd8, 0x07, 0x8c, 0xbc, 0xf4, 0x8e, 0x64, 0xdd, 0xd6, 0xba, 0x31, 0xf0, 0x81, 0x16, 0x8e,
|
||||
0xc4, 0x35, 0xcc, 0xb2, 0x2d, 0xec, 0x07, 0x09, 0xdb, 0x9e, 0x64, 0xd3, 0xd6, 0x7a, 0x6c, 0xa6,
|
||||
0x3b, 0xfa, 0x64, 0x7b, 0xba, 0x45, 0x18, 0x3d, 0x0c, 0x09, 0xc4, 0x33, 0x9c, 0x7e, 0xff, 0xbb,
|
||||
0xb8, 0xec, 0x3e, 0xfb, 0x74, 0xbf, 0xc4, 0x39, 0x57, 0x7f, 0x4d, 0xb6, 0xa7, 0xab, 0x83, 0xd5,
|
||||
0x68, 0xc8, 0x7d, 0xf7, 0x1e, 0x00, 0x00, 0xff, 0xff, 0x0d, 0xb6, 0xf8, 0x4e, 0x7e, 0x01, 0x00,
|
||||
0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// MasterClient is the client API for Master service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type MasterClient interface {
|
||||
CreateCollection(ctx context.Context, in *CreateCollectionRequest, opts ...grpc.CallOption) (*CreateCollectionResponse, error)
|
||||
}
|
||||
|
||||
type masterClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewMasterClient(cc *grpc.ClientConn) MasterClient {
|
||||
return &masterClient{cc}
|
||||
}
|
||||
|
||||
func (c *masterClient) CreateCollection(ctx context.Context, in *CreateCollectionRequest, opts ...grpc.CallOption) (*CreateCollectionResponse, error) {
|
||||
out := new(CreateCollectionResponse)
|
||||
err := c.cc.Invoke(ctx, "/masterpb.Master/CreateCollection", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MasterServer is the server API for Master service.
|
||||
type MasterServer interface {
|
||||
CreateCollection(context.Context, *CreateCollectionRequest) (*CreateCollectionResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedMasterServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedMasterServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedMasterServer) CreateCollection(ctx context.Context, req *CreateCollectionRequest) (*CreateCollectionResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateCollection not implemented")
|
||||
}
|
||||
|
||||
func RegisterMasterServer(s *grpc.Server, srv MasterServer) {
|
||||
s.RegisterService(&_Master_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Master_CreateCollection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateCollectionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MasterServer).CreateCollection(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/masterpb.Master/CreateCollection",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MasterServer).CreateCollection(ctx, req.(*CreateCollectionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Master_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "masterpb.Master",
|
||||
HandlerType: (*MasterServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "CreateCollection",
|
||||
Handler: _Master_CreateCollection_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "master.proto",
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
syntax = "proto3";
|
||||
|
||||
//option go_package = "github.com/czs007/suvilm/pkg/master/grpc";
|
||||
package masterpb;
|
||||
|
||||
service Master {
|
||||
rpc CreateCollection (CreateCollectionRequest) returns (CreateCollectionResponse) {}
|
||||
}
|
||||
|
||||
|
||||
message CreateCollectionRequest {
|
||||
string collection_name = 1;
|
||||
}
|
||||
|
||||
message CreateCollectionResponse {
|
||||
string collection_name = 1;
|
||||
uint64 collection_id = 2;
|
||||
repeated uint64 segment_ids = 3;
|
||||
repeated string partition_tags = 4;
|
||||
}
|
|
@ -0,0 +1,369 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: pkg/master/grpc/master/master.proto
|
||||
|
||||
package master
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
message "github.com/czs007/suvlim/pkg/master/grpc/message"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type Collection struct {
|
||||
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Schema *message.Schema `protobuf:"bytes,3,opt,name=schema,proto3" json:"schema,omitempty"`
|
||||
CreateTime uint64 `protobuf:"varint,4,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
|
||||
SegmentIds []uint64 `protobuf:"varint,5,rep,packed,name=segment_ids,json=segmentIds,proto3" json:"segment_ids,omitempty"`
|
||||
PartitionTags []string `protobuf:"bytes,6,rep,name=partition_tags,json=partitionTags,proto3" json:"partition_tags,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Collection) Reset() { *m = Collection{} }
|
||||
func (m *Collection) String() string { return proto.CompactTextString(m) }
|
||||
func (*Collection) ProtoMessage() {}
|
||||
func (*Collection) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_64c7f42561e95429, []int{0}
|
||||
}
|
||||
|
||||
func (m *Collection) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Collection.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Collection) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Collection.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Collection) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Collection.Merge(m, src)
|
||||
}
|
||||
func (m *Collection) XXX_Size() int {
|
||||
return xxx_messageInfo_Collection.Size(m)
|
||||
}
|
||||
func (m *Collection) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Collection.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Collection proto.InternalMessageInfo
|
||||
|
||||
func (m *Collection) GetId() uint64 {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Collection) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Collection) GetSchema() *message.Schema {
|
||||
if m != nil {
|
||||
return m.Schema
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Collection) GetCreateTime() uint64 {
|
||||
if m != nil {
|
||||
return m.CreateTime
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Collection) GetSegmentIds() []uint64 {
|
||||
if m != nil {
|
||||
return m.SegmentIds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Collection) GetPartitionTags() []string {
|
||||
if m != nil {
|
||||
return m.PartitionTags
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Segment struct {
|
||||
SegmentId uint64 `protobuf:"varint,1,opt,name=segment_id,json=segmentId,proto3" json:"segment_id,omitempty"`
|
||||
CollectionId uint64 `protobuf:"varint,2,opt,name=collection_id,json=collectionId,proto3" json:"collection_id,omitempty"`
|
||||
PartitionTag string `protobuf:"bytes,3,opt,name=partition_tag,json=partitionTag,proto3" json:"partition_tag,omitempty"`
|
||||
ChannelStart int32 `protobuf:"varint,4,opt,name=channel_start,json=channelStart,proto3" json:"channel_start,omitempty"`
|
||||
ChannelEnd int32 `protobuf:"varint,5,opt,name=channel_end,json=channelEnd,proto3" json:"channel_end,omitempty"`
|
||||
OpenTimestamp uint64 `protobuf:"varint,6,opt,name=open_timestamp,json=openTimestamp,proto3" json:"open_timestamp,omitempty"`
|
||||
CloseTimestamp uint64 `protobuf:"varint,7,opt,name=close_timestamp,json=closeTimestamp,proto3" json:"close_timestamp,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Segment) Reset() { *m = Segment{} }
|
||||
func (m *Segment) String() string { return proto.CompactTextString(m) }
|
||||
func (*Segment) ProtoMessage() {}
|
||||
func (*Segment) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_64c7f42561e95429, []int{1}
|
||||
}
|
||||
|
||||
func (m *Segment) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Segment.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Segment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Segment.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Segment) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Segment.Merge(m, src)
|
||||
}
|
||||
func (m *Segment) XXX_Size() int {
|
||||
return xxx_messageInfo_Segment.Size(m)
|
||||
}
|
||||
func (m *Segment) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Segment.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Segment proto.InternalMessageInfo
|
||||
|
||||
func (m *Segment) GetSegmentId() uint64 {
|
||||
if m != nil {
|
||||
return m.SegmentId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Segment) GetCollectionId() uint64 {
|
||||
if m != nil {
|
||||
return m.CollectionId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Segment) GetPartitionTag() string {
|
||||
if m != nil {
|
||||
return m.PartitionTag
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Segment) GetChannelStart() int32 {
|
||||
if m != nil {
|
||||
return m.ChannelStart
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Segment) GetChannelEnd() int32 {
|
||||
if m != nil {
|
||||
return m.ChannelEnd
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Segment) GetOpenTimestamp() uint64 {
|
||||
if m != nil {
|
||||
return m.OpenTimestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Segment) GetCloseTimestamp() uint64 {
|
||||
if m != nil {
|
||||
return m.CloseTimestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type SegmentStat struct {
|
||||
SegmentId uint64 `protobuf:"varint,1,opt,name=segment_id,json=segmentId,proto3" json:"segment_id,omitempty"`
|
||||
MemorySize uint64 `protobuf:"varint,2,opt,name=memory_size,json=memorySize,proto3" json:"memory_size,omitempty"`
|
||||
MemoryRate float32 `protobuf:"fixed32,3,opt,name=memory_rate,json=memoryRate,proto3" json:"memory_rate,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *SegmentStat) Reset() { *m = SegmentStat{} }
|
||||
func (m *SegmentStat) String() string { return proto.CompactTextString(m) }
|
||||
func (*SegmentStat) ProtoMessage() {}
|
||||
func (*SegmentStat) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_64c7f42561e95429, []int{2}
|
||||
}
|
||||
|
||||
func (m *SegmentStat) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_SegmentStat.Unmarshal(m, b)
|
||||
}
|
||||
func (m *SegmentStat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_SegmentStat.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *SegmentStat) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_SegmentStat.Merge(m, src)
|
||||
}
|
||||
func (m *SegmentStat) XXX_Size() int {
|
||||
return xxx_messageInfo_SegmentStat.Size(m)
|
||||
}
|
||||
func (m *SegmentStat) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_SegmentStat.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_SegmentStat proto.InternalMessageInfo
|
||||
|
||||
func (m *SegmentStat) GetSegmentId() uint64 {
|
||||
if m != nil {
|
||||
return m.SegmentId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *SegmentStat) GetMemorySize() uint64 {
|
||||
if m != nil {
|
||||
return m.MemorySize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *SegmentStat) GetMemoryRate() float32 {
|
||||
if m != nil {
|
||||
return m.MemoryRate
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Collection)(nil), "masterpb.Collection")
|
||||
proto.RegisterType((*Segment)(nil), "masterpb.Segment")
|
||||
proto.RegisterType((*SegmentStat)(nil), "masterpb.SegmentStat")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("pkg/master/grpc/master/master.proto", fileDescriptor_64c7f42561e95429)
|
||||
}
|
||||
|
||||
var fileDescriptor_64c7f42561e95429 = []byte{
|
||||
// 447 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xcf, 0x6e, 0xd3, 0x40,
|
||||
0x10, 0xc6, 0x89, 0x93, 0xb8, 0x64, 0xf2, 0x07, 0xb4, 0x70, 0xb0, 0x2a, 0xa1, 0x5a, 0xa9, 0x2a,
|
||||
0x22, 0x21, 0xd9, 0xa5, 0x1c, 0x38, 0x22, 0x51, 0x71, 0xe8, 0xa1, 0x17, 0x3b, 0x27, 0x2e, 0xd6,
|
||||
0xc6, 0x1e, 0x39, 0x2b, 0xbc, 0xeb, 0x95, 0x77, 0x52, 0x89, 0x3c, 0x01, 0x4f, 0xc6, 0x73, 0x21,
|
||||
0x8f, 0x9d, 0x34, 0x05, 0xa4, 0x9e, 0x76, 0xfd, 0xf9, 0xb7, 0x33, 0x3b, 0xdf, 0x7e, 0x70, 0x69,
|
||||
0x7f, 0x94, 0xb1, 0x96, 0x8e, 0xb0, 0x89, 0xcb, 0xc6, 0xe6, 0x87, 0x7d, 0xb7, 0x44, 0xb6, 0xa9,
|
||||
0xa9, 0x16, 0x2f, 0xbb, 0x2f, 0xbb, 0x39, 0xbf, 0xfa, 0x07, 0x47, 0xe7, 0x64, 0x89, 0x87, 0xb5,
|
||||
0x3b, 0xb0, 0xfc, 0x3d, 0x00, 0xb8, 0xad, 0xab, 0x0a, 0x73, 0x52, 0xb5, 0x11, 0x0b, 0xf0, 0x54,
|
||||
0x11, 0x0c, 0xc2, 0xc1, 0x6a, 0x94, 0x78, 0xaa, 0x10, 0x02, 0x46, 0x46, 0x6a, 0x0c, 0xbc, 0x70,
|
||||
0xb0, 0x9a, 0x24, 0xbc, 0x17, 0x1f, 0xc0, 0x77, 0xf9, 0x16, 0xb5, 0x0c, 0x86, 0xe1, 0x60, 0x35,
|
||||
0xbd, 0x79, 0x13, 0x69, 0x55, 0x3d, 0xec, 0x5c, 0xd4, 0xb6, 0x89, 0x52, 0xfe, 0x95, 0xf4, 0x88,
|
||||
0xb8, 0x80, 0x69, 0xde, 0xa0, 0x24, 0xcc, 0x48, 0x69, 0x0c, 0x46, 0x5c, 0x19, 0x3a, 0x69, 0xad,
|
||||
0x34, 0xb6, 0x80, 0xc3, 0x52, 0xa3, 0xa1, 0x4c, 0x15, 0x2e, 0x18, 0x87, 0xc3, 0x16, 0xe8, 0xa5,
|
||||
0xbb, 0xc2, 0x89, 0x2b, 0x58, 0x58, 0xd9, 0x90, 0x6a, 0xef, 0x97, 0x91, 0x2c, 0x5d, 0xe0, 0x87,
|
||||
0xc3, 0xd5, 0x24, 0x99, 0x1f, 0xd5, 0xb5, 0x2c, 0xdd, 0xf2, 0x97, 0x07, 0x67, 0x69, 0x77, 0x4a,
|
||||
0xbc, 0x03, 0x78, 0xac, 0xd9, 0x4f, 0x33, 0x39, 0x96, 0x14, 0x97, 0x30, 0xcf, 0x8f, 0x23, 0xb7,
|
||||
0x84, 0xc7, 0xc4, 0xec, 0x51, 0xec, 0xa0, 0x27, 0x6d, 0x79, 0xd8, 0x49, 0x32, 0x3b, 0xed, 0xca,
|
||||
0x95, 0xb6, 0xd2, 0x18, 0xac, 0x32, 0x47, 0xb2, 0x21, 0x9e, 0x6f, 0x9c, 0xcc, 0x7a, 0x31, 0x6d,
|
||||
0x35, 0xb6, 0xa0, 0x87, 0xd0, 0x14, 0xc1, 0x98, 0x11, 0xe8, 0xa5, 0x6f, 0xa6, 0x68, 0x27, 0xac,
|
||||
0x2d, 0x1a, 0x76, 0xc8, 0x91, 0xd4, 0x36, 0xf0, 0xf9, 0x42, 0xf3, 0x56, 0x5d, 0x1f, 0x44, 0xf1,
|
||||
0x1e, 0x5e, 0xe5, 0x55, 0xed, 0xf0, 0x84, 0x3b, 0x63, 0x6e, 0xc1, 0xf2, 0x11, 0x5c, 0x1a, 0x98,
|
||||
0xf6, 0x4e, 0xa4, 0x24, 0x9f, 0x75, 0xe3, 0x02, 0xa6, 0x1a, 0x75, 0xdd, 0xfc, 0xcc, 0x9c, 0xda,
|
||||
0x63, 0xef, 0x05, 0x74, 0x52, 0xaa, 0xf6, 0x78, 0x02, 0x34, 0x92, 0x90, 0x7d, 0xf0, 0x0e, 0x40,
|
||||
0x22, 0x09, 0x6f, 0xee, 0xc0, 0xbf, 0xe7, 0xa0, 0x89, 0x2f, 0xf0, 0xfa, 0x96, 0x9f, 0xf6, 0x24,
|
||||
0x52, 0x6f, 0x9f, 0xc4, 0xe3, 0x5e, 0x5a, 0xab, 0x4c, 0x79, 0xfe, 0x57, 0x68, 0x48, 0xd2, 0xce,
|
||||
0x2d, 0x5f, 0x7c, 0xfd, 0xf8, 0x3d, 0x2e, 0x15, 0x6d, 0x77, 0x9b, 0x28, 0xaf, 0x75, 0x9c, 0xef,
|
||||
0xdd, 0xf5, 0xf5, 0xe7, 0xd8, 0xed, 0x1e, 0x2a, 0xa5, 0xe3, 0xff, 0xe7, 0x7f, 0xe3, 0x73, 0x90,
|
||||
0x3f, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0xf9, 0x1d, 0xf9, 0x37, 0x20, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// MasterClient is the client API for Master service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type MasterClient interface {
|
||||
CreateCollection(ctx context.Context, in *message.Mapping, opts ...grpc.CallOption) (*message.Status, error)
|
||||
}
|
||||
|
||||
type masterClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewMasterClient(cc *grpc.ClientConn) MasterClient {
|
||||
return &masterClient{cc}
|
||||
}
|
||||
|
||||
func (c *masterClient) CreateCollection(ctx context.Context, in *message.Mapping, opts ...grpc.CallOption) (*message.Status, error) {
|
||||
out := new(message.Status)
|
||||
err := c.cc.Invoke(ctx, "/masterpb.Master/CreateCollection", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MasterServer is the server API for Master service.
|
||||
type MasterServer interface {
|
||||
CreateCollection(context.Context, *message.Mapping) (*message.Status, error)
|
||||
}
|
||||
|
||||
// UnimplementedMasterServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedMasterServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedMasterServer) CreateCollection(ctx context.Context, req *message.Mapping) (*message.Status, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateCollection not implemented")
|
||||
}
|
||||
|
||||
func RegisterMasterServer(s *grpc.Server, srv MasterServer) {
|
||||
s.RegisterService(&_Master_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Master_CreateCollection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(message.Mapping)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MasterServer).CreateCollection(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/masterpb.Master/CreateCollection",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MasterServer).CreateCollection(ctx, req.(*message.Mapping))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Master_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "masterpb.Master",
|
||||
HandlerType: (*MasterServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "CreateCollection",
|
||||
Handler: _Master_CreateCollection_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "pkg/master/grpc/master/master.proto",
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package masterpb;
|
||||
|
||||
option go_package="github.com/czs007/suvlim/pkg/master/grpc/master";
|
||||
|
||||
import "pkg/master/grpc/message/message.proto";
|
||||
|
||||
message Collection {
|
||||
uint64 id=1;
|
||||
string name=2;
|
||||
milvus.grpc.Schema schema=3;
|
||||
uint64 create_time=4;
|
||||
repeated uint64 segment_ids=5;
|
||||
repeated string partition_tags=6;
|
||||
}
|
||||
|
||||
message Segment {
|
||||
uint64 segment_id=1;
|
||||
uint64 collection_id =2;
|
||||
string partition_tag=3;
|
||||
int32 channel_start=4;
|
||||
int32 channel_end=5;
|
||||
uint64 open_timestamp=6;
|
||||
uint64 close_timestamp=7;
|
||||
}
|
||||
|
||||
message SegmentStat {
|
||||
uint64 segment_id=1;
|
||||
uint64 memory_size=2;
|
||||
float memory_rate=3;
|
||||
}
|
||||
|
||||
service Master {
|
||||
rpc CreateCollection(milvus.grpc.Mapping) returns (milvus.grpc.Status){}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,715 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package milvus.grpc;
|
||||
option go_package="github.com/czs007/suvlim/pkg/master/grpc/message";
|
||||
|
||||
enum ErrorCode {
|
||||
SUCCESS = 0;
|
||||
UNEXPECTED_ERROR = 1;
|
||||
CONNECT_FAILED = 2;
|
||||
PERMISSION_DENIED = 3;
|
||||
COLLECTION_NOT_EXISTS = 4;
|
||||
ILLEGAL_ARGUMENT = 5;
|
||||
ILLEGAL_DIMENSION = 7;
|
||||
ILLEGAL_INDEX_TYPE = 8;
|
||||
ILLEGAL_COLLECTION_NAME = 9;
|
||||
ILLEGAL_TOPK = 10;
|
||||
ILLEGAL_ROWRECORD = 11;
|
||||
ILLEGAL_VECTOR_ID = 12;
|
||||
ILLEGAL_SEARCH_RESULT = 13;
|
||||
FILE_NOT_FOUND = 14;
|
||||
META_FAILED = 15;
|
||||
CACHE_FAILED = 16;
|
||||
CANNOT_CREATE_FOLDER = 17;
|
||||
CANNOT_CREATE_FILE = 18;
|
||||
CANNOT_DELETE_FOLDER = 19;
|
||||
CANNOT_DELETE_FILE = 20;
|
||||
BUILD_INDEX_ERROR = 21;
|
||||
ILLEGAL_NLIST = 22;
|
||||
ILLEGAL_METRIC_TYPE = 23;
|
||||
OUT_OF_MEMORY = 24;
|
||||
}
|
||||
|
||||
message Status {
|
||||
ErrorCode error_code = 1;
|
||||
string reason = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Field data type
|
||||
*/
|
||||
enum DataType {
|
||||
NONE = 0;
|
||||
BOOL = 1;
|
||||
INT8 = 2;
|
||||
INT16 = 3;
|
||||
INT32 = 4;
|
||||
INT64 = 5;
|
||||
|
||||
FLOAT = 10;
|
||||
DOUBLE = 11;
|
||||
|
||||
STRING = 20;
|
||||
|
||||
VECTOR_BINARY = 100;
|
||||
VECTOR_FLOAT = 101;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief General usage
|
||||
*/
|
||||
message KeyValuePair {
|
||||
string key = 1;
|
||||
string value = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Collection name
|
||||
*/
|
||||
message CollectionName {
|
||||
string collection_name = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Collection name list
|
||||
*/
|
||||
message CollectionNameList {
|
||||
Status status = 1;
|
||||
repeated string collection_names = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Field name
|
||||
*/
|
||||
message FieldName {
|
||||
string collection_name = 1;
|
||||
string field_name = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Collection mapping
|
||||
* @extra_params: key-value pair for extra parameters of the collection
|
||||
* typically usage:
|
||||
* extra_params["params"] = {segment_row_count: 1000000, auto_id: true}
|
||||
* Note:
|
||||
* the segment_row_count specify segment row count limit for merging
|
||||
* the auto_id = true means entity id is auto-generated by milvus
|
||||
*/
|
||||
message Mapping {
|
||||
Status status = 1;
|
||||
string collection_name = 2;
|
||||
Schema schema = 3;
|
||||
repeated KeyValuePair extra_params = 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Collection mapping list
|
||||
*/
|
||||
message MappingList {
|
||||
Status status = 1;
|
||||
repeated Mapping mapping_list = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Parameters of partition
|
||||
*/
|
||||
message PartitionParam {
|
||||
string collection_name = 1;
|
||||
string tag = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Partition list
|
||||
*/
|
||||
message PartitionList {
|
||||
Status status = 1;
|
||||
repeated string partition_tag_array = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Vector row record
|
||||
*/
|
||||
message VectorRowRecord {
|
||||
repeated float float_data = 1; //float vector data
|
||||
bytes binary_data = 2; //binary vector data
|
||||
}
|
||||
|
||||
message EntityIds {
|
||||
Status status = 1;
|
||||
repeated int64 entity_id_array = 2;
|
||||
}
|
||||
|
||||
message VectorRecord {
|
||||
repeated VectorRowRecord records = 1;
|
||||
}
|
||||
|
||||
message VectorParam {
|
||||
string json = 1;
|
||||
VectorRecord row_record = 2;
|
||||
}
|
||||
|
||||
//////////////////////////row schema and data///////////////////////////////////
|
||||
/**
|
||||
* @brief schema
|
||||
*/
|
||||
message FieldMeta {
|
||||
string field_name = 1;
|
||||
DataType type = 2;
|
||||
int64 dim = 3;
|
||||
}
|
||||
|
||||
message Schema {
|
||||
repeated FieldMeta field_metas = 1;
|
||||
}
|
||||
|
||||
message RowData {
|
||||
bytes blob = 1;
|
||||
}
|
||||
|
||||
//////////////////////suvlim-proxy///////////////////////////////////
|
||||
message InsertParam {
|
||||
string collection_name = 1;
|
||||
Schema schema = 2;
|
||||
repeated RowData rows_data = 3;
|
||||
repeated int64 entity_id_array = 4; //optional
|
||||
string partition_tag = 5;
|
||||
repeated KeyValuePair extra_params = 6;
|
||||
}
|
||||
|
||||
message SearchParam {
|
||||
string collection_name = 1;
|
||||
repeated VectorParam vector_param = 2;
|
||||
string dsl = 3; //optional
|
||||
repeated string partition_tag = 4; //why
|
||||
repeated KeyValuePair extra_params = 5;
|
||||
}
|
||||
|
||||
message SearchInSegmentParam {
|
||||
repeated string file_id_array = 1;
|
||||
SearchParam search_param = 2;
|
||||
}
|
||||
|
||||
message Entities {
|
||||
Status status = 1;
|
||||
repeated int64 ids = 2;
|
||||
repeated bool valid_row = 3;
|
||||
repeated RowData rows_data = 4;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////milvus-server///////////////////////////
|
||||
/**
|
||||
* @brief Query result
|
||||
*/
|
||||
message QueryResult {
|
||||
Status status = 1;
|
||||
Entities entities = 2;
|
||||
int64 row_num = 3;
|
||||
repeated float scores = 4;
|
||||
repeated float distances = 5;
|
||||
repeated KeyValuePair extra_params = 6;
|
||||
int64 query_id = 7;
|
||||
int64 client_id = 8;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Server string Reply
|
||||
*/
|
||||
message StringReply {
|
||||
Status status = 1;
|
||||
string string_reply = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Server bool Reply
|
||||
*/
|
||||
message BoolReply {
|
||||
Status status = 1;
|
||||
bool bool_reply = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return collection row count
|
||||
*/
|
||||
message CollectionRowCount {
|
||||
Status status = 1;
|
||||
int64 collection_row_count = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Server command parameters
|
||||
*/
|
||||
message Command {
|
||||
string cmd = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Index params
|
||||
* @collection_name: target collection
|
||||
* @field_name: target field
|
||||
* @index_name: a name for index provided by user, unique within this field
|
||||
* @extra_params: index parameters in json format
|
||||
* for vector field:
|
||||
* extra_params["index_type"] = one of the values: FLAT, IVF_LAT, IVF_SQ8, NSGMIX, IVFSQ8H,
|
||||
* PQ, HNSW, HNSW_SQ8NM, ANNOY
|
||||
* extra_params["metric_type"] = one of the values: L2, IP, HAMMING, JACCARD, TANIMOTO
|
||||
* SUBSTRUCTURE, SUPERSTRUCTURE
|
||||
* extra_params["params"] = extra parameters for index, for example ivflat: {nlist: 2048}
|
||||
* for structured field:
|
||||
* extra_params["index_type"] = one of the values: SORTED
|
||||
*/
|
||||
message IndexParam {
|
||||
Status status = 1;
|
||||
string collection_name = 2;
|
||||
string field_name = 3;
|
||||
string index_name = 4;
|
||||
repeated KeyValuePair extra_params = 5;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Parameters for flush action
|
||||
*/
|
||||
message FlushParam {
|
||||
repeated string collection_name_array = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Parameters for flush action
|
||||
*/
|
||||
message CompactParam {
|
||||
string collection_name = 1;
|
||||
double threshold = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Parameters for deleting entities by id
|
||||
*/
|
||||
message DeleteByIDParam {
|
||||
string collection_name = 1;
|
||||
repeated int64 id_array = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return collection stats
|
||||
* @json_info: collection stats in json format, typically, the format is like:
|
||||
* {
|
||||
* row_count: xxx,
|
||||
* data_size: xxx,
|
||||
* partitions: [
|
||||
* {
|
||||
* tag: xxx,
|
||||
* id: xxx,
|
||||
* row_count: xxx,
|
||||
* data_size: xxx,
|
||||
* segments: [
|
||||
* {
|
||||
* id: xxx,
|
||||
* row_count: xxx,
|
||||
* data_size: xxx,
|
||||
* files: [
|
||||
* {
|
||||
* field: xxx,
|
||||
* name: xxx,
|
||||
* index_type: xxx,
|
||||
* path: xxx,
|
||||
* data_size: xxx,
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
message CollectionInfo {
|
||||
Status status = 1;
|
||||
string json_info = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Parameters for returning entities id of a segment
|
||||
*/
|
||||
message GetEntityIDsParam {
|
||||
string collection_name = 1;
|
||||
int64 segment_id = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Entities identity
|
||||
*/
|
||||
message EntityIdentity {
|
||||
string collection_name = 1;
|
||||
repeated int64 id_array = 2;
|
||||
repeated string field_names = 3;
|
||||
}
|
||||
|
||||
/********************************************SearchPB interface***************************************************/
|
||||
/**
|
||||
* @brief Vector field parameters
|
||||
*/
|
||||
message VectorFieldParam {
|
||||
int64 dimension = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Field type
|
||||
*/
|
||||
message FieldType {
|
||||
oneof value {
|
||||
DataType data_type = 1;
|
||||
VectorFieldParam vector_param = 2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Field parameters
|
||||
*/
|
||||
message FieldParam {
|
||||
uint64 id = 1;
|
||||
string name = 2;
|
||||
DataType type = 3;
|
||||
repeated KeyValuePair index_params = 4;
|
||||
repeated KeyValuePair extra_params = 5;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Vector field record
|
||||
*/
|
||||
message VectorFieldRecord {
|
||||
repeated VectorRowRecord value = 1;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
message TermQuery {
|
||||
string field_name = 1;
|
||||
repeated int64 int_value = 2;
|
||||
repeated double double_value = 3;
|
||||
int64 value_num = 4;
|
||||
float boost = 5;
|
||||
repeated KeyValuePair extra_params = 6;
|
||||
}
|
||||
|
||||
enum CompareOperator {
|
||||
LT = 0;
|
||||
LTE = 1;
|
||||
EQ = 2;
|
||||
GT = 3;
|
||||
GTE = 4;
|
||||
NE = 5;
|
||||
}
|
||||
|
||||
message CompareExpr {
|
||||
CompareOperator operator = 1;
|
||||
string operand = 2;
|
||||
}
|
||||
|
||||
message RangeQuery {
|
||||
string field_name = 1;
|
||||
repeated CompareExpr operand = 2;
|
||||
float boost = 3;
|
||||
repeated KeyValuePair extra_params = 4;
|
||||
}
|
||||
|
||||
message VectorQuery {
|
||||
string field_name = 1;
|
||||
float query_boost = 2;
|
||||
repeated VectorRowRecord records = 3;
|
||||
int64 topk = 4;
|
||||
repeated KeyValuePair extra_params = 5;
|
||||
}
|
||||
|
||||
enum Occur {
|
||||
INVALID = 0;
|
||||
MUST = 1;
|
||||
SHOULD = 2;
|
||||
MUST_NOT = 3;
|
||||
}
|
||||
|
||||
message BooleanQuery {
|
||||
Occur occur = 1;
|
||||
repeated GeneralQuery general_query = 2;
|
||||
}
|
||||
|
||||
message GeneralQuery {
|
||||
oneof query {
|
||||
BooleanQuery boolean_query = 1;
|
||||
TermQuery term_query = 2;
|
||||
RangeQuery range_query = 3;
|
||||
VectorQuery vector_query = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message SearchParamPB {
|
||||
string collection_name = 1;
|
||||
repeated string partition_tag_array = 2;
|
||||
GeneralQuery general_query = 3;
|
||||
repeated KeyValuePair extra_params = 4;
|
||||
}
|
||||
|
||||
service MilvusService {
|
||||
/**
|
||||
* @brief This method is used to create collection
|
||||
*
|
||||
* @param CollectionSchema, use to provide collection information to be created.
|
||||
*
|
||||
* @return Status
|
||||
*/
|
||||
rpc CreateCollection(Mapping) returns (Status){}
|
||||
|
||||
/**
|
||||
* @brief This method is used to test collection existence.
|
||||
*
|
||||
* @param CollectionName, collection name is going to be tested.
|
||||
*
|
||||
* @return BoolReply
|
||||
*/
|
||||
rpc HasCollection(CollectionName) returns (BoolReply) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to get collection schema.
|
||||
*
|
||||
* @param CollectionName, target collection name.
|
||||
*
|
||||
* @return CollectionSchema
|
||||
*/
|
||||
rpc DescribeCollection(CollectionName) returns (Mapping) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to get collection schema.
|
||||
*
|
||||
* @param CollectionName, target collection name.
|
||||
*
|
||||
* @return CollectionRowCount
|
||||
*/
|
||||
rpc CountCollection(CollectionName) returns (CollectionRowCount) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to list all collections.
|
||||
*
|
||||
* @param Command, dummy parameter.
|
||||
*
|
||||
* @return CollectionNameList
|
||||
*/
|
||||
rpc ShowCollections(Command) returns (CollectionNameList) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to get collection detail information.
|
||||
*
|
||||
* @param CollectionName, target collection name.
|
||||
*
|
||||
* @return CollectionInfo
|
||||
*/
|
||||
rpc ShowCollectionInfo(CollectionName) returns (CollectionInfo) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to delete collection.
|
||||
*
|
||||
* @param CollectionName, collection name is going to be deleted.
|
||||
*
|
||||
* @return Status
|
||||
*/
|
||||
rpc DropCollection(CollectionName) returns (Status) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to build index by collection in sync mode.
|
||||
*
|
||||
* @param IndexParam, index paramters.
|
||||
*
|
||||
* @return Status
|
||||
*/
|
||||
rpc CreateIndex(IndexParam) returns (Status) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to describe index
|
||||
*
|
||||
* @param IndexParam, target index.
|
||||
*
|
||||
* @return IndexParam
|
||||
*/
|
||||
rpc DescribeIndex(IndexParam) returns (IndexParam) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to drop index
|
||||
*
|
||||
* @param IndexParam, target field. if the IndexParam.field_name is empty, will drop all index of the collection
|
||||
*
|
||||
* @return Status
|
||||
*/
|
||||
rpc DropIndex(IndexParam) returns (Status) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to create partition
|
||||
*
|
||||
* @param PartitionParam, partition parameters.
|
||||
*
|
||||
* @return Status
|
||||
*/
|
||||
rpc CreatePartition(PartitionParam) returns (Status) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to test partition existence.
|
||||
*
|
||||
* @param PartitionParam, target partition.
|
||||
*
|
||||
* @return BoolReply
|
||||
*/
|
||||
rpc HasPartition(PartitionParam) returns (BoolReply) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to show partition information
|
||||
*
|
||||
* @param CollectionName, target collection name.
|
||||
*
|
||||
* @return PartitionList
|
||||
*/
|
||||
rpc ShowPartitions(CollectionName) returns (PartitionList) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to drop partition
|
||||
*
|
||||
* @param PartitionParam, target partition.
|
||||
*
|
||||
* @return Status
|
||||
*/
|
||||
rpc DropPartition(PartitionParam) returns (Status) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to add vector array to collection.
|
||||
*
|
||||
* @param InsertParam, insert parameters.
|
||||
*
|
||||
* @return VectorIds
|
||||
*/
|
||||
rpc Insert(InsertParam) returns (EntityIds) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to get entities data by id array.
|
||||
*
|
||||
* @param EntitiesIdentity, target entity id array.
|
||||
*
|
||||
* @return EntitiesData
|
||||
*/
|
||||
rpc GetEntityByID(EntityIdentity) returns (Entities) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to get vector ids from a segment
|
||||
*
|
||||
* @param GetVectorIDsParam, target collection and segment
|
||||
*
|
||||
* @return VectorIds
|
||||
*/
|
||||
rpc GetEntityIDs(GetEntityIDsParam) returns (EntityIds) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to query vector in collection.
|
||||
*
|
||||
* @param SearchParam, search parameters.
|
||||
*
|
||||
* @return KQueryResult
|
||||
*/
|
||||
rpc Search(SearchParam) returns (QueryResult) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to query vector in specified files.
|
||||
*
|
||||
* @param SearchInSegmentParam, target segments to search.
|
||||
*
|
||||
* @return TopKQueryResult
|
||||
*/
|
||||
rpc SearchInSegment(SearchInSegmentParam) returns (QueryResult) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to give the server status.
|
||||
*
|
||||
* @param Command, command string
|
||||
*
|
||||
* @return StringReply
|
||||
*/
|
||||
rpc Cmd(Command) returns (StringReply) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to delete vector by id
|
||||
*
|
||||
* @param DeleteByIDParam, delete parameters.
|
||||
*
|
||||
* @return status
|
||||
*/
|
||||
rpc DeleteByID(DeleteByIDParam) returns (Status) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to preload collection
|
||||
*
|
||||
* @param CollectionName, target collection name.
|
||||
*
|
||||
* @return Status
|
||||
*/
|
||||
rpc PreloadCollection(CollectionName) returns (Status) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to flush buffer into storage.
|
||||
*
|
||||
* @param FlushParam, flush parameters
|
||||
*
|
||||
* @return Status
|
||||
*/
|
||||
rpc Flush(FlushParam) returns (Status) {}
|
||||
|
||||
/**
|
||||
* @brief This method is used to compact collection
|
||||
*
|
||||
* @param CompactParam, compact parameters
|
||||
*
|
||||
* @return Status
|
||||
*/
|
||||
rpc Compact(CompactParam) returns (Status) {}
|
||||
|
||||
/********************************New Interface********************************************/
|
||||
|
||||
rpc SearchPB(SearchParamPB) returns (QueryResult) {}
|
||||
}
|
||||
|
||||
////////////////////pulsar//////////////////////////////////////
|
||||
enum OpType {
|
||||
INSERT = 0;
|
||||
DELETE = 1;
|
||||
}
|
||||
|
||||
message InsertOrDeleteMsg {
|
||||
string collection_name = 1;
|
||||
RowData rows_data = 2;
|
||||
int64 uid = 3; //optional
|
||||
string partition_tag = 4;
|
||||
uint64 timestamp =5;
|
||||
int64 segment_id = 6;
|
||||
int64 channel_id = 7;
|
||||
OpType op = 8;
|
||||
int64 client_id = 9;
|
||||
repeated KeyValuePair extra_params = 10;
|
||||
}
|
||||
|
||||
message SearchMsg {
|
||||
string collection_name = 1;
|
||||
VectorRowRecord records = 2;
|
||||
string partition_tag = 3;
|
||||
int64 uid = 4;
|
||||
uint64 timestamp =5;
|
||||
int64 client_id = 6;
|
||||
repeated KeyValuePair extra_params = 7;
|
||||
}
|
||||
|
||||
enum SyncType {
|
||||
READ = 0;
|
||||
WRITE = 1;
|
||||
}
|
||||
message TimeSyncMsg{
|
||||
int64 peer_Id = 1;
|
||||
uint64 Timestamp = 2;
|
||||
SyncType sync_type = 3;
|
||||
}
|
||||
|
||||
message Key2SegMsg {
|
||||
int64 uid = 1;
|
||||
uint64 timestamp = 2;
|
||||
repeated int64 segment_id = 3;
|
||||
}
|
|
@ -5,7 +5,8 @@ import (
|
|||
"log"
|
||||
"time"
|
||||
|
||||
pb "github.com/czs007/suvlim/pkg/master/grpc"
|
||||
pb "github.com/czs007/suvlim/pkg/master/grpc/master"
|
||||
msgpb "github.com/czs007/suvlim/pkg/master/grpc/message"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
|
@ -49,11 +50,14 @@ func FakeCreateCollectionByGRPC() (string, uint64) {
|
|||
|
||||
defer cancel()
|
||||
|
||||
r, err := c.CreateCollection(ctx, &pb.CreateCollectionRequest{CollectionName: "grpc-client-test"})
|
||||
r, err := c.CreateCollection(ctx, &msgpb.Mapping{
|
||||
CollectionName: "test-collection",
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("could not greet: %v", err)
|
||||
}
|
||||
|
||||
log.Printf("CreateCollection: %s, id: %d", r.GetCollectionName(), r.GetCollectionId())
|
||||
return r.GetCollectionName(), r.GetCollectionId()
|
||||
// log.Printf("CreateCollection: %s, id: %d", r.GetCollectionName(), r.GetCollectionId())
|
||||
// return r.GetCollectionName(), r.GetCollectionId()
|
||||
return r.GetReason(), 0
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ import (
|
|||
)
|
||||
|
||||
func TestFakeCreateCollectionByGRPC(t *testing.T) {
|
||||
collectionName, segmentID := FakeCreateCollectionByGRPC()
|
||||
if collectionName != "grpc-client-test" {
|
||||
t.Error("Collection name wrong")
|
||||
reason, segmentID := FakeCreateCollectionByGRPC()
|
||||
if reason != "" {
|
||||
t.Error(reason)
|
||||
}
|
||||
fmt.Println(collectionName)
|
||||
fmt.Println(segmentID)
|
||||
|
|
|
@ -9,7 +9,8 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/czs007/suvlim/pkg/master/common"
|
||||
pb "github.com/czs007/suvlim/pkg/master/grpc"
|
||||
pb "github.com/czs007/suvlim/pkg/master/grpc/master"
|
||||
messagepb "github.com/czs007/suvlim/pkg/master/grpc/message"
|
||||
"github.com/czs007/suvlim/pkg/master/informer"
|
||||
"github.com/czs007/suvlim/pkg/master/kv"
|
||||
"github.com/czs007/suvlim/pkg/master/mock"
|
||||
|
@ -90,12 +91,19 @@ func GRPCServer() error {
|
|||
|
||||
type GRPCMasterServer struct{}
|
||||
|
||||
func (ms GRPCMasterServer) CreateCollection(ctx context.Context, in *pb.CreateCollectionRequest) (*pb.CreateCollectionResponse, error) {
|
||||
return &pb.CreateCollectionResponse{
|
||||
CollectionName: in.CollectionName,
|
||||
func (ms GRPCMasterServer) CreateCollection(ctx context.Context, in *messagepb.Mapping) (*messagepb.Status, error) {
|
||||
return &messagepb.Status{
|
||||
ErrorCode: 0,
|
||||
Reason: "",
|
||||
}, nil
|
||||
}
|
||||
|
||||
// func (ms GRPCMasterServer) CreateCollection(ctx context.Context, in *pb.CreateCollectionRequest) (*pb.CreateCollectionResponse, error) {
|
||||
// return &pb.CreateCollectionResponse{
|
||||
// CollectionName: in.CollectionName,
|
||||
// }, nil
|
||||
// }
|
||||
|
||||
func CollectionController() {
|
||||
cli, _ := clientv3.New(clientv3.Config{
|
||||
Endpoints: []string{"127.0.0.1:12379"},
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package masterpb;
|
||||
|
||||
option go_package="master";
|
||||
|
||||
import "message.proto";
|
||||
|
||||
message Collection {
|
||||
uint64 id=1;
|
||||
string name=2;
|
||||
milvus.grpc.Schema schema=3;
|
||||
uint64 create_time=4;
|
||||
repeated uint64 segment_ids=5;
|
||||
repeated string partition_tags=6;
|
||||
}
|
||||
|
||||
message Segment {
|
||||
uint64 segment_id=1;
|
||||
uint64 collection_id =2;
|
||||
string partition_tag=3;
|
||||
int32 channel_start=4;
|
||||
int32 channel_end=5;
|
||||
uint64 open_timestamp=6;
|
||||
uint64 close_timestamp=7;
|
||||
}
|
||||
|
||||
message SegmentStat {
|
||||
uint64 segment_id=1;
|
||||
uint64 memory_size=2;
|
||||
float memory_rate=3;
|
||||
}
|
||||
|
||||
service Master {
|
||||
rpc CreateCollection(milvus.grpc.Mapping) returns (milvus.grpc.Status){}
|
||||
}
|
Loading…
Reference in New Issue