httpserver

package
v0.10.3-0...-f06509b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// --- category ---
	CollectionCategory = "/collections/"
	EntityCategory     = "/entities/"
	PartitionCategory  = "/partitions/"
	UserCategory       = "/users/"
	RoleCategory       = "/roles/"
	IndexCategory      = "/indexes/"
	AliasCategory      = "/aliases/"
	ImportJobCategory  = "/jobs/import/"

	ListAction           = "list"
	HasAction            = "has"
	DescribeAction       = "describe"
	CreateAction         = "create"
	DropAction           = "drop"
	StatsAction          = "get_stats"
	LoadStateAction      = "get_load_state"
	RenameAction         = "rename"
	LoadAction           = "load"
	ReleaseAction        = "release"
	QueryAction          = "query"
	GetAction            = "get"
	DeleteAction         = "delete"
	InsertAction         = "insert"
	UpsertAction         = "upsert"
	SearchAction         = "search"
	AdvancedSearchAction = "advanced_search"
	HybridSearchAction   = "hybrid_search"

	UpdatePasswordAction  = "update_password"
	GrantRoleAction       = "grant_role"
	RevokeRoleAction      = "revoke_role"
	GrantPrivilegeAction  = "grant_privilege"
	RevokePrivilegeAction = "revoke_privilege"
	AlterAction           = "alter"
	GetProgressAction     = "get_progress"
)

v2

View Source
const (
	ContextUsername               = "username"
	VectorCollectionsPath         = "/vector/collections"
	VectorCollectionsCreatePath   = "/vector/collections/create"
	VectorCollectionsDescribePath = "/vector/collections/describe"
	VectorCollectionsDropPath     = "/vector/collections/drop"
	VectorInsertPath              = "/vector/insert"
	VectorUpsertPath              = "/vector/upsert"
	VectorSearchPath              = "/vector/search"
	VectorGetPath                 = "/vector/get"
	VectorQueryPath               = "/vector/query"
	VectorDeletePath              = "/vector/delete"

	ShardNumDefault = 1

	EnableDynamic = true
	EnableAutoID  = true
	DisableAutoID = false

	HTTPCollectionName       = "collectionName"
	HTTPCollectionID         = "collectionID"
	HTTPDbName               = "dbName"
	HTTPPartitionName        = "partitionName"
	HTTPPartitionNames       = "partitionNames"
	HTTPUserName             = "userName"
	HTTPRoleName             = "roleName"
	HTTPIndexName            = "indexName"
	HTTPIndexField           = "fieldName"
	HTTPAliasName            = "aliasName"
	HTTPRequestData          = "data"
	DefaultDbName            = "default"
	DefaultIndexName         = "vector_idx"
	DefaultAliasName         = "the_alias"
	DefaultOutputFields      = "*"
	HTTPHeaderAllowInt64     = "Accept-Type-Allow-Int64"
	HTTPHeaderDBName         = "DB-Name"
	HTTPHeaderRequestTimeout = "Request-Timeout"
	HTTPDefaultTimeout       = 30 * time.Second
	HTTPReturnCode           = "code"
	HTTPReturnMessage        = "message"
	HTTPReturnData           = "data"
	HTTPReturnLoadState      = "loadState"
	HTTPReturnLoadProgress   = "loadProgress"

	HTTPReturnHas = "has"

	HTTPReturnFieldName         = "name"
	HTTPReturnFieldID           = "id"
	HTTPReturnFieldType         = "type"
	HTTPReturnFieldPrimaryKey   = "primaryKey"
	HTTPReturnFieldPartitionKey = "partitionKey"
	HTTPReturnFieldAutoID       = "autoId"
	HTTPReturnFieldElementType  = "elementType"
	HTTPReturnDescription       = "description"

	HTTPReturnIndexMetricType  = "metricType"
	HTTPReturnIndexType        = "indexType"
	HTTPReturnIndexTotalRows   = "totalRows"
	HTTPReturnIndexPendingRows = "pendingRows"
	HTTPReturnIndexIndexedRows = "indexedRows"
	HTTPReturnIndexState       = "indexState"
	HTTPReturnIndexFailReason  = "failReason"

	HTTPReturnDistance = "distance"

	HTTPReturnRowCount = "rowCount"

	HTTPReturnObjectType = "objectType"
	HTTPReturnObjectName = "objectName"
	HTTPReturnPrivilege  = "privilege"
	HTTPReturnGrantor    = "grantor"
	HTTPReturnDbName     = "dbName"

	DefaultMetricType       = metric.COSINE
	DefaultPrimaryFieldName = "id"
	DefaultVectorFieldName  = "vector"

	Dim = "dim"
)
View Source
const (
	ParamAnnsField    = "anns_field"
	Params            = "params"
	ParamRoundDecimal = "round_decimal"
	ParamOffset       = "offset"
	ParamLimit        = "limit"
	ParamRadius       = "radius"
	ParamRangeFilter  = "range_filter"
	ParamGroupByField = "group_by_field"
	BoundedTimestamp  = 2
)

Variables

View Source
var RestRequestInterceptorErr = errors.New("interceptor error placeholder")

Functions

func GetAuthorization

func GetAuthorization(c *gin.Context) string

func ParseUsernamePassword

func ParseUsernamePassword(c *gin.Context) (string, string, bool)

Types

type AliasCollectionReq

type AliasCollectionReq struct {
	DbName         string `json:"dbName"`
	CollectionName string `json:"collectionName" binding:"required"`
	AliasName      string `json:"aliasName" binding:"required"`
}

func (*AliasCollectionReq) GetAliasName

func (req *AliasCollectionReq) GetAliasName() string

func (*AliasCollectionReq) GetCollectionName

func (req *AliasCollectionReq) GetCollectionName() string

func (*AliasCollectionReq) GetDbName

func (req *AliasCollectionReq) GetDbName() string

type AliasNameGetter

type AliasNameGetter interface {
	GetAliasName() string
}

type AliasReq

type AliasReq struct {
	DbName    string `json:"dbName"`
	AliasName string `json:"aliasName" binding:"required"`
}

func (*AliasReq) GetAliasName

func (req *AliasReq) GetAliasName() string

func (*AliasReq) GetDbName

func (req *AliasReq) GetDbName() string

type BaseGetter

type BaseGetter interface {
	GetBase() *commonpb.MsgBase
}

type BufferPool

type BufferPool struct {
	// contains filtered or unexported fields
}

BufferPool represents a pool of buffers.

func (*BufferPool) Get

func (p *BufferPool) Get() *bytes.Buffer

Get returns a buffer from the buffer pool. If the pool is empty, a new buffer is created and returned.

func (*BufferPool) Put

func (p *BufferPool) Put(buf *bytes.Buffer)

Put adds a buffer back to the pool.

type CollectionDataReq

type CollectionDataReq struct {
	DbName         string                   `json:"dbName"`
	CollectionName string                   `json:"collectionName" binding:"required"`
	PartitionName  string                   `json:"partitionName"`
	Data           []map[string]interface{} `json:"data" binding:"required"`
}

func (*CollectionDataReq) GetDbName

func (req *CollectionDataReq) GetDbName() string

type CollectionFilterReq

type CollectionFilterReq struct {
	DbName         string `json:"dbName"`
	CollectionName string `json:"collectionName" binding:"required"`
	PartitionName  string `json:"partitionName"`
	Filter         string `json:"filter" binding:"required"`
}

func (*CollectionFilterReq) GetDbName

func (req *CollectionFilterReq) GetDbName() string

type CollectionIDReq

type CollectionIDReq struct {
	DbName         string      `json:"dbName"`
	CollectionName string      `json:"collectionName" binding:"required"`
	PartitionName  string      `json:"partitionName"`
	PartitionNames []string    `json:"partitionNames"`
	OutputFields   []string    `json:"outputFields"`
	ID             interface{} `json:"id" binding:"required"`
}

func (*CollectionIDReq) GetDbName

func (req *CollectionIDReq) GetDbName() string

type CollectionNameReq

type CollectionNameReq struct {
	DbName         string   `json:"dbName"`
	CollectionName string   `json:"collectionName" binding:"required"`
	PartitionNames []string `json:"partitionNames"` // get partitions load state
}

func (*CollectionNameReq) GetCollectionName

func (req *CollectionNameReq) GetCollectionName() string

func (*CollectionNameReq) GetDbName

func (req *CollectionNameReq) GetDbName() string

func (*CollectionNameReq) GetPartitionNames

func (req *CollectionNameReq) GetPartitionNames() []string

type CollectionReq

type CollectionReq struct {
	DbName           string                 `json:"dbName"`
	CollectionName   string                 `json:"collectionName" binding:"required"`
	Dimension        int32                  `json:"dimension"`
	IDType           string                 `json:"idType"`
	AutoID           bool                   `json:"autoID"`
	MetricType       string                 `json:"metricType"`
	PrimaryFieldName string                 `json:"primaryFieldName"`
	VectorFieldName  string                 `json:"vectorFieldName"`
	Schema           CollectionSchema       `json:"schema"`
	IndexParams      []IndexParam           `json:"indexParams"`
	Params           map[string]interface{} `json:"params"`
}

func (*CollectionReq) GetDbName

func (req *CollectionReq) GetDbName() string

type CollectionSchema

type CollectionSchema struct {
	Fields             []FieldSchema `json:"fields"`
	AutoId             bool          `json:"autoID"`
	EnableDynamicField bool          `json:"enableDynamicField"`
}

type CreateCollectionReq

type CreateCollectionReq struct {
	DbName             string `json:"dbName"`
	CollectionName     string `json:"collectionName" validate:"required"`
	Dimension          int32  `json:"dimension" validate:"required"`
	Description        string `json:"description"`
	MetricType         string `json:"metricType"`
	PrimaryField       string `json:"primaryField"`
	VectorField        string `json:"vectorField"`
	EnableDynamicField bool   `json:"enableDynamicField"`
}

type DatabaseReq

type DatabaseReq struct {
	DbName string `json:"dbName"`
}

func (*DatabaseReq) GetDbName

func (req *DatabaseReq) GetDbName() string

type DeleteReq

type DeleteReq struct {
	DbName         string      `json:"dbName"`
	CollectionName string      `json:"collectionName" validate:"required"`
	ID             interface{} `json:"id"`
	Filter         string      `json:"filter"`
}

type DropCollectionReq

type DropCollectionReq struct {
	DbName         string `json:"dbName"`
	CollectionName string `json:"collectionName" validate:"required"`
}

type ErrResponse

type ErrResponse = commonpb.Status

ErrResponse of server

type FieldData

type FieldData struct {
	Type      schemapb.DataType `json:"type,omitempty"`
	FieldName string            `json:"field_name,omitempty"`
	Field     json.RawMessage   `json:"field,omitempty"` // we use postpone the unmarshal until we know the type
	FieldID   int64             `json:"field_id,omitempty"`
}

FieldData is the field data in RESTful request that can be convertd to schemapb.FieldData

func (*FieldData) AsSchemapb

func (f *FieldData) AsSchemapb() (*schemapb.FieldData, error)

AsSchemapb converts the FieldData to schemapb.FieldData

type FieldSchema

type FieldSchema struct {
	FieldName         string                 `json:"fieldName" binding:"required"`
	DataType          string                 `json:"dataType" binding:"required"`
	ElementDataType   string                 `json:"elementDataType"`
	IsPrimary         bool                   `json:"isPrimary"`
	IsPartitionKey    bool                   `json:"isPartitionKey"`
	ElementTypeParams map[string]interface{} `json:"elementTypeParams" binding:"required"`
}

type FilesGetter

type FilesGetter interface {
	GetFiles() [][]string
}

type GetReq

type GetReq struct {
	DbName         string      `json:"dbName"`
	CollectionName string      `json:"collectionName" validate:"required"`
	OutputFields   []string    `json:"outputFields"`
	ID             interface{} `json:"id" validate:"required"`
}

type GrantReq

type GrantReq struct {
	RoleName   string `json:"roleName" binding:"required"`
	ObjectType string `json:"objectType" binding:"required"`
	ObjectName string `json:"objectName" binding:"required"`
	Privilege  string `json:"privilege" binding:"required"`
	DbName     string `json:"dbName"`
}

type Handlers

type Handlers struct {
	// contains filtered or unexported fields
}

Handlers handles http requests

func NewHandlers

func NewHandlers(proxy types.ProxyComponent) *Handlers

NewHandlers creates a new Handlers

func (*Handlers) RegisterRoutesTo

func (h *Handlers) RegisterRoutesTo(router gin.IRouter)

RegisterRouters registers routes to given router

type HandlersV1

type HandlersV1 struct {
	// contains filtered or unexported fields
}

HandlersV1 handles http requests

func NewHandlersV1

func NewHandlersV1(proxyComponent types.ProxyComponent) *HandlersV1

NewHandlers creates a new HandlersV1

func (*HandlersV1) RegisterRoutesToV1

func (h *HandlersV1) RegisterRoutesToV1(router gin.IRouter)

type HandlersV2

type HandlersV2 struct {
	// contains filtered or unexported fields
}

func NewHandlersV2

func NewHandlersV2(proxyClient types.ProxyComponent) *HandlersV2

func (*HandlersV2) GetCollectionSchema

func (h *HandlersV2) GetCollectionSchema(ctx context.Context, c *gin.Context, dbName, collectionName string) (*schemapb.CollectionSchema, error)

func (*HandlersV2) RegisterRoutesToV2

func (h *HandlersV2) RegisterRoutesToV2(router gin.IRouter)

type HybridSearchReq

type HybridSearchReq struct {
	DbName         string         `json:"dbName"`
	CollectionName string         `json:"collectionName" binding:"required"`
	PartitionNames []string       `json:"partitionNames"`
	Search         []SubSearchReq `json:"search"`
	Rerank         Rand           `json:"rerank"`
	Limit          int32          `json:"limit"`
	OutputFields   []string       `json:"outputFields"`
}

func (*HybridSearchReq) GetDbName

func (req *HybridSearchReq) GetDbName() string

type ImportReq

type ImportReq struct {
	DbName         string            `json:"dbName"`
	CollectionName string            `json:"collectionName" binding:"required"`
	PartitionName  string            `json:"partitionName"`
	Files          [][]string        `json:"files" binding:"required"`
	Options        map[string]string `json:"options"`
}

func (*ImportReq) GetCollectionName

func (req *ImportReq) GetCollectionName() string

func (*ImportReq) GetDbName

func (req *ImportReq) GetDbName() string

func (*ImportReq) GetFiles

func (req *ImportReq) GetFiles() [][]string

func (*ImportReq) GetOptions

func (req *ImportReq) GetOptions() map[string]string

func (*ImportReq) GetPartitionName

func (req *ImportReq) GetPartitionName() string

type IndexNameGetter

type IndexNameGetter interface {
	GetIndexName() string
}

type IndexParam

type IndexParam struct {
	FieldName  string                 `json:"fieldName" binding:"required"`
	IndexName  string                 `json:"indexName" binding:"required"`
	MetricType string                 `json:"metricType" binding:"required"`
	Params     map[string]interface{} `json:"params"`
}

type IndexParamReq

type IndexParamReq struct {
	DbName         string       `json:"dbName"`
	CollectionName string       `json:"collectionName" binding:"required"`
	IndexParams    []IndexParam `json:"indexParams" binding:"required"`
}

func (*IndexParamReq) GetDbName

func (req *IndexParamReq) GetDbName() string

type IndexReq

type IndexReq struct {
	DbName         string `json:"dbName"`
	CollectionName string `json:"collectionName" binding:"required"`
	IndexName      string `json:"indexName" binding:"required"`
}

func (*IndexReq) GetCollectionName

func (req *IndexReq) GetCollectionName() string

func (*IndexReq) GetDbName

func (req *IndexReq) GetDbName() string

func (*IndexReq) GetIndexName

func (req *IndexReq) GetIndexName() string

type InsertReq

type InsertReq struct {
	DbName         string                   `json:"dbName"`
	CollectionName string                   `json:"collectionName" validate:"required"`
	Data           []map[string]interface{} `json:"data" validate:"required"`
}

type JobIDGetter

type JobIDGetter interface {
	GetJobID() string
}

type JobIDReq

type JobIDReq struct {
	JobID string `json:"jobId" binding:"required"`
}

func (*JobIDReq) GetJobID

func (req *JobIDReq) GetJobID() string

type NewPasswordReq

type NewPasswordReq struct {
	UserName    string `json:"userName" binding:"required"`
	Password    string `json:"password" binding:"required"`
	NewPassword string `json:"newPassword" binding:"required"`
}

type OptionalCollectionNameReq

type OptionalCollectionNameReq struct {
	DbName         string `json:"dbName"`
	CollectionName string `json:"collectionName"`
}

func (*OptionalCollectionNameReq) GetCollectionName

func (req *OptionalCollectionNameReq) GetCollectionName() string

func (*OptionalCollectionNameReq) GetDbName

func (req *OptionalCollectionNameReq) GetDbName() string

type OptionsGetter

type OptionsGetter interface {
	GetOptions() map[string]string
}

type PartitionReq

type PartitionReq struct {
	// CollectionNameReq
	DbName         string `json:"dbName"`
	CollectionName string `json:"collectionName" binding:"required"`
	PartitionName  string `json:"partitionName" binding:"required"`
}

func (*PartitionReq) GetCollectionName

func (req *PartitionReq) GetCollectionName() string

func (*PartitionReq) GetDbName

func (req *PartitionReq) GetDbName() string

func (*PartitionReq) GetPartitionName

func (req *PartitionReq) GetPartitionName() string

type PartitionsReq

type PartitionsReq struct {
	// CollectionNameReq
	DbName         string   `json:"dbName"`
	CollectionName string   `json:"collectionName" binding:"required"`
	PartitionNames []string `json:"partitionNames" binding:"required"`
}

func (*PartitionsReq) GetDbName

func (req *PartitionsReq) GetDbName() string

type PasswordReq

type PasswordReq struct {
	UserName string `json:"userName" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type QueryReq

type QueryReq struct {
	DbName         string   `json:"dbName"`
	CollectionName string   `json:"collectionName" validate:"required"`
	OutputFields   []string `json:"outputFields"`
	Filter         string   `json:"filter" validate:"required"`
	Limit          int32    `json:"limit"`
	Offset         int32    `json:"offset"`
}

type QueryReqV2

type QueryReqV2 struct {
	DbName         string   `json:"dbName"`
	CollectionName string   `json:"collectionName" binding:"required"`
	PartitionNames []string `json:"partitionNames"`
	OutputFields   []string `json:"outputFields"`
	Filter         string   `json:"filter" binding:"required"`
	Limit          int32    `json:"limit"`
	Offset         int32    `json:"offset"`
}

func (*QueryReqV2) GetDbName

func (req *QueryReqV2) GetDbName() string

type Rand

type Rand struct {
	Strategy string                 `json:"strategy"`
	Params   map[string]interface{} `json:"params"`
}

type RenameCollectionReq

type RenameCollectionReq struct {
	DbName            string `json:"dbName"`
	CollectionName    string `json:"collectionName" binding:"required"`
	NewCollectionName string `json:"newCollectionName" binding:"required"`
	NewDbName         string `json:"newDbName"`
}

func (*RenameCollectionReq) GetDbName

func (req *RenameCollectionReq) GetDbName() string

type RestRequestInterceptor

type RestRequestInterceptor func(ctx context.Context, ginCtx *gin.Context, req any, handler func(reqCtx context.Context, req any) (any, error)) (any, error)

type ReturnErrMsg

type ReturnErrMsg struct {
	Code    int32  `json:"code"`
	Message string `json:"message"`
}

type RoleNameGetter

type RoleNameGetter interface {
	GetRoleName() string
}

type RoleReq

type RoleReq struct {
	RoleName string `json:"roleName" binding:"required"`
}

func (*RoleReq) GetRoleName

func (req *RoleReq) GetRoleName() string

type SearchReq

type SearchReq struct {
	DbName         string             `json:"dbName"`
	CollectionName string             `json:"collectionName" validate:"required"`
	Filter         string             `json:"filter"`
	Limit          int32              `json:"limit"`
	Offset         int32              `json:"offset"`
	OutputFields   []string           `json:"outputFields"`
	Vector         []float32          `json:"vector"`
	Params         map[string]float64 `json:"params"`
}

type SearchReqV2

type SearchReqV2 struct {
	DbName         string             `json:"dbName"`
	CollectionName string             `json:"collectionName" binding:"required"`
	Data           []interface{}      `json:"data" binding:"required"`
	AnnsField      string             `json:"annsField"`
	PartitionNames []string           `json:"partitionNames"`
	Filter         string             `json:"filter"`
	GroupByField   string             `json:"groupingField"`
	Limit          int32              `json:"limit"`
	Offset         int32              `json:"offset"`
	OutputFields   []string           `json:"outputFields"`
	Params         map[string]float64 `json:"params"`
}

func (*SearchReqV2) GetDbName

func (req *SearchReqV2) GetDbName() string

type SearchRequest

type SearchRequest struct {
	Base               *commonpb.MsgBase        `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
	DbName             string                   `protobuf:"bytes,2,opt,name=db_name,json=dbName,proto3" json:"db_name,omitempty"`
	CollectionName     string                   `protobuf:"bytes,3,opt,name=collection_name,json=collectionName,proto3" json:"collection_name,omitempty"`
	PartitionNames     []string                 `protobuf:"bytes,4,rep,name=partition_names,json=partitionNames,proto3" json:"partition_names,omitempty"`
	Dsl                string                   `protobuf:"bytes,5,opt,name=dsl,proto3" json:"dsl,omitempty"`
	DslType            commonpb.DslType         `protobuf:"varint,7,opt,name=dsl_type,json=dslType,proto3,enum=milvus.proto.common.DslType" json:"dsl_type,omitempty"`
	BinaryVectors      [][]byte                 `json:"binary_vectors,omitempty"`
	Vectors            [][]float32              `json:"vectors,omitempty"`
	OutputFields       []string                 `protobuf:"bytes,8,rep,name=output_fields,json=outputFields,proto3" json:"output_fields,omitempty"`
	SearchParams       []*commonpb.KeyValuePair `protobuf:"bytes,9,rep,name=search_params,json=searchParams,proto3" json:"search_params,omitempty"`
	TravelTimestamp    uint64                   `protobuf:"varint,10,opt,name=travel_timestamp,json=travelTimestamp,proto3" json:"travel_timestamp,omitempty"`
	GuaranteeTimestamp uint64                   `protobuf:"varint,11,opt,name=guarantee_timestamp,json=guaranteeTimestamp,proto3" json:"guarantee_timestamp,omitempty"`
	Nq                 int64                    `protobuf:"varint,12,opt,name=nq,proto3" json:"nq,omitempty"`
}

SearchRequest is the RESTful request body for search

type SingleInsertReq

type SingleInsertReq struct {
	DbName         string                 `json:"dbName"`
	CollectionName string                 `json:"collectionName" validate:"required"`
	Data           map[string]interface{} `json:"data" validate:"required"`
}

type SingleUpsertReq

type SingleUpsertReq struct {
	DbName         string                 `json:"dbName"`
	CollectionName string                 `json:"collectionName" validate:"required"`
	Data           map[string]interface{} `json:"data" validate:"required"`
}

type SubSearchReq

type SubSearchReq struct {
	Data          []interface{}      `json:"data" binding:"required"`
	AnnsField     string             `json:"annsField"`
	Filter        string             `json:"filter"`
	GroupByField  string             `json:"groupingField"`
	MetricType    string             `json:"metricType"`
	Limit         int32              `json:"limit"`
	Offset        int32              `json:"offset"`
	IgnoreGrowing bool               `json:"ignoreGrowing"`
	Params        map[string]float64 `json:"params"`
}

type Timeout

type Timeout struct {
	// contains filtered or unexported fields
}

Timeout struct

type UpsertReq

type UpsertReq struct {
	DbName         string                   `json:"dbName"`
	CollectionName string                   `json:"collectionName" validate:"required"`
	Data           []map[string]interface{} `json:"data" validate:"required"`
}

type UserNameGetter

type UserNameGetter interface {
	GetUserName() string
}

type UserReq

type UserReq struct {
	UserName string `json:"userName" binding:"required"`
}

func (*UserReq) GetUserName

func (req *UserReq) GetUserName() string

type UserRoleReq

type UserRoleReq struct {
	UserName string `json:"userName" binding:"required"`
	RoleName string `json:"roleName" binding:"required"`
}

type VectorIDs

type VectorIDs struct {
	CollectionName string   `protobuf:"bytes,1,opt,name=collection_name,json=collectionName,proto3" json:"collection_name,omitempty"`
	FieldName      string   `protobuf:"bytes,2,opt,name=field_name,json=fieldName,proto3" json:"field_name,omitempty"`
	PartitionNames []string `json:"partition_names"`
	IDArray        []int64  `json:"id_array,omitempty"`
}

VectorIDs is an array of id reference in milvus

type VectorsArray

type VectorsArray struct {
	// Dim of vectors or binary_vectors, not needed when use ids
	Dim int64 `json:"dim,omitempty"`
	// Vectors is an array of vector divided by given dim. Disabled when ids or binary_vectors is set
	Vectors []float32 `json:"vectors,omitempty"`
	// Vectors is an array of binary vector divided by given dim. Disabled when IDs is set
	BinaryVectors []byte `json:"binary_vectors,omitempty"`
	// IDs of vector field in milvus, if not nil, vectors will be ignored
	IDs *VectorIDs `json:"ids,omitempty"`
}

VectorsArray is vector array, assigned by vectors or ids

func (*VectorsArray) AsPbVectorArray

func (v *VectorsArray) AsPbVectorArray() *milvuspb.VectorsArray

AsPbVectorArray convert as milvuspb.VectorArray

type WrappedCalcDistanceRequest

type WrappedCalcDistanceRequest struct {
	Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`

	OpLeft  VectorsArray `json:"op_left,omitempty"`
	OpRight VectorsArray `json:"op_right,omitempty"`

	Params []*commonpb.KeyValuePair `json:"params,omitempty"`
}

WrappedCalcDistanceRequest is the RESTful request body for calc distance

type WrappedCreateCollectionRequest

type WrappedCreateCollectionRequest struct {
	// Not useful for now
	Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
	// Not useful for now
	DbName string `protobuf:"bytes,2,opt,name=db_name,json=dbName,proto3" json:"db_name,omitempty"`
	// The unique collection name in milvus.(Required)
	CollectionName string `protobuf:"bytes,3,opt,name=collection_name,json=collectionName,proto3" json:"collection_name,omitempty"`
	// The serialized `schema.CollectionSchema`(Required)
	Schema schemapb.CollectionSchema `protobuf:"bytes,4,opt,name=schema,proto3" json:"schema,omitempty"`
	// Once set, no modification is allowed (Optional)
	// https://github.com/milvus-io/milvus/issues/6690
	ShardsNum int32 `protobuf:"varint,5,opt,name=shards_num,json=shardsNum,proto3" json:"shards_num,omitempty"`
	// The consistency level that the collection used, modification is not supported now.
	ConsistencyLevel commonpb.ConsistencyLevel `` /* 152-byte string literal not displayed */
	Properties       []*commonpb.KeyValuePair  `protobuf:"bytes,13,rep,name=properties,proto3" json:"properties,omitempty"`
}

WrappedCreateCollectionRequest wraps CreateCollectionRequest

type WrappedInsertRequest

type WrappedInsertRequest struct {
	Base           *commonpb.MsgBase `json:"base,omitempty"`
	DbName         string            `json:"db_name,omitempty"`
	CollectionName string            `json:"collection_name,omitempty"`
	PartitionName  string            `json:"partition_name,omitempty"`
	FieldsData     []*FieldData      `json:"fields_data,omitempty"`
	HashKeys       []uint32          `json:"hash_keys,omitempty"`
	NumRows        uint32            `json:"num_rows,omitempty"`
}

WrappedInsertRequest is the InsertRequest wrapped for RESTful request

func (*WrappedInsertRequest) AsInsertRequest

func (w *WrappedInsertRequest) AsInsertRequest() (*milvuspb.InsertRequest, error)

type Writer

type Writer struct {
	gin.ResponseWriter
	// contains filtered or unexported fields
}

Writer is a writer with memory buffer

func NewWriter

func NewWriter(w gin.ResponseWriter, buf *bytes.Buffer) *Writer

NewWriter will return a timeout.Writer pointer

func (*Writer) FreeBuffer

func (w *Writer) FreeBuffer()

FreeBuffer will release buffer pointer

func (*Writer) Header

func (w *Writer) Header() http.Header

Header will get response headers

func (*Writer) Status

func (w *Writer) Status() int

Status we must override Status func here, or the http status code returned by gin.Context.Writer.Status() will always be 200 in other custom gin middlewares.

func (*Writer) Write

func (w *Writer) Write(data []byte) (int, error)

Write will write data to response body

func (*Writer) WriteHeader

func (w *Writer) WriteHeader(code int)

WriteHeader sends an HTTP response header with the provided status code. If the response writer has already written headers or if a timeout has occurred, this method does nothing.

func (*Writer) WriteString

func (w *Writer) WriteString(s string) (int, error)

WriteString will write string to response body

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL