httpserver

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

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

Go to latest
Published: Jan 19, 2025 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// --- category ---
	DataBaseCategory        = "/databases/"
	CollectionCategory      = "/collections/"
	EntityCategory          = "/entities/"
	PartitionCategory       = "/partitions/"
	UserCategory            = "/users/"
	RoleCategory            = "/roles/"
	IndexCategory           = "/indexes/"
	AliasCategory           = "/aliases/"
	ImportJobCategory       = "/jobs/import/"
	PrivilegeGroupCategory  = "/privilege_groups/"
	CollectionFieldCategory = "/collections/fields/"
	ResourceGroupCategory   = "/resource_groups/"

	ListAction           = "list"
	HasAction            = "has"
	DescribeAction       = "describe"
	CreateAction         = "create"
	DropAction           = "drop"
	StatsAction          = "get_stats"
	LoadStateAction      = "get_load_state"
	RenameAction         = "rename"
	LoadAction           = "load"
	RefreshLoadAction    = "refresh_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"
	GrantPrivilegeActionV2          = "grant_privilege_v2"
	RevokePrivilegeActionV2         = "revoke_privilege_v2"
	AlterAction                     = "alter"
	AlterPropertiesAction           = "alter_properties"
	DropPropertiesAction            = "drop_properties"
	GetProgressAction               = "get_progress" // deprecated, keep it for compatibility, use `/v2/vectordb/jobs/import/describe` instead
	AddPrivilegesToGroupAction      = "add_privileges_to_group"
	RemovePrivilegesFromGroupAction = "remove_privileges_from_group"
	TransferReplicaAction           = "transfer_replica"
)

v2

View Source
const (
	ContextRequest                = "request"
	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"
	HTTPDbID                 = "dbID"
	HTTPProperties           = "properties"
	HTTPPartitionName        = "partitionName"
	HTTPPartitionNames       = "partitionNames"
	HTTPUserName             = "userName"
	HTTPRoleName             = "roleName"
	HTTPIndexName            = "indexName"
	HTTPIndexField           = "fieldName"
	HTTPAliasName            = "aliasName"
	HTTPRequestData          = "data"
	HTTPRequestDefaultValue  = "defaultValue"
	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"
	HTTPReturnCost           = "cost"
	HTTPReturnLoadState      = "loadState"
	HTTPReturnLoadProgress   = "loadProgress"

	HTTPReturnHas = "has"

	HTTPReturnFieldName             = "name"
	HTTPReturnFieldID               = "id"
	HTTPReturnFieldType             = "type"
	HTTPReturnFieldPrimaryKey       = "primaryKey"
	HTTPReturnFieldPartitionKey     = "partitionKey"
	HTTPReturnFieldClusteringKey    = "clusteringKey"
	HTTPReturnFieldNullable         = "nullable"
	HTTPReturnFieldDefaultValue     = "defaultValue"
	HTTPReturnFieldAutoID           = "autoId"
	HTTPReturnFieldElementType      = "elementType"
	HTTPReturnDescription           = "description"
	HTTPReturnFieldIsFunctionOutput = "isFunctionOutput"

	HTTPReturnFunctionName             = "name"
	HTTPReturnFunctionID               = "id"
	HTTPReturnFunctionType             = "type"
	HTTPReturnFunctionInputFieldNames  = "inputFieldNames"
	HTTPReturnFunctionOutputFieldNames = "outputFieldNames"
	HTTPReturnFunctionParams           = "params"

	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"
	HTTPReturnPrivilegeGroupName = "privilegeGroupName"
	HTTPReturnPrivileges         = "privileges"
	HTTPReturnPrivilegeGroups    = "privilegeGroups"

	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"
	ParamGroupSize       = "group_size"
	ParamStrictGroupSize = "strict_group_size"
	BoundedTimestamp     = 2
)

Variables

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

Functions

func CheckLimiter

func CheckLimiter(ctx context.Context, req interface{}, pxy types.ProxyComponent) (any, error)

func GetAuthorization

func GetAuthorization(c *gin.Context) string

func HTTPAbortReturn

func HTTPAbortReturn(c *gin.Context, code int, result gin.H)

func HTTPReturn

func HTTPReturn(c *gin.Context, code int, result gin.H)

func HTTPReturnStream

func HTTPReturnStream(c *gin.Context, code int, result gin.H)

HTTPReturnStream uses custom jsonRender that encodes JSON data directly into the response stream, it uses less memory since it does not buffer the entire JSON structure before sending it, unlike c.JSON in HTTPReturn, which serializes the JSON fully in memory before writing it to the response.

func LoggerHandlerFunc

func LoggerHandlerFunc() gin.HandlerFunc

func MetricsHandlerFunc

func MetricsHandlerFunc(c *gin.Context)

func ParseUsernamePassword

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

func RequestHandlerFunc

func RequestHandlerFunc(c *gin.Context)

func WrapErrorToResponse

func WrapErrorToResponse(err error) *milvuspb.BoolResponse

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 CollectionFieldReqWithParams

type CollectionFieldReqWithParams struct {
	DbName         string                 `json:"dbName"`
	CollectionName string                 `json:"collectionName" binding:"required"`
	FieldName      string                 `json:"fieldName" binding:"required"`
	FieldParams    map[string]interface{} `json:"fieldParams"`
}

func (*CollectionFieldReqWithParams) GetCollectionName

func (req *CollectionFieldReqWithParams) GetCollectionName() string

func (*CollectionFieldReqWithParams) GetDbName

func (req *CollectionFieldReqWithParams) GetDbName() string

func (*CollectionFieldReqWithParams) GetFieldName

func (req *CollectionFieldReqWithParams) GetFieldName() 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"`
	ExprParams     map[string]interface{} `json:"exprParams"`
}

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 CollectionReqWithProperties

type CollectionReqWithProperties struct {
	DbName         string                 `json:"dbName"`
	CollectionName string                 `json:"collectionName" binding:"required"`
	Properties     map[string]interface{} `json:"properties"`
}

func (*CollectionReqWithProperties) GetCollectionName

func (req *CollectionReqWithProperties) GetCollectionName() string

func (*CollectionReqWithProperties) GetDbName

func (req *CollectionReqWithProperties) GetDbName() string

type CollectionSchema

type CollectionSchema struct {
	Fields             []FieldSchema    `json:"fields"`
	Functions          []FunctionSchema `json:"functions"`
	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 DatabaseReqRequiredName

type DatabaseReqRequiredName struct {
	DbName string `json:"dbName" binding:"required"`
}

func (*DatabaseReqRequiredName) GetDbName

func (req *DatabaseReqRequiredName) GetDbName() string

type DatabaseReqWithProperties

type DatabaseReqWithProperties struct {
	DbName     string                 `json:"dbName" binding:"required"`
	Properties map[string]interface{} `json:"properties"`
}

func (*DatabaseReqWithProperties) GetDbName

func (req *DatabaseReqWithProperties) 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 DropCollectionPropertiesReq

type DropCollectionPropertiesReq struct {
	DbName         string   `json:"dbName"`
	CollectionName string   `json:"collectionName" binding:"required"`
	DeleteKeys     []string `json:"deleteKeys"`
}

func (*DropCollectionPropertiesReq) GetCollectionName

func (req *DropCollectionPropertiesReq) GetCollectionName() string

func (*DropCollectionPropertiesReq) GetDbName

func (req *DropCollectionPropertiesReq) GetDbName() string

type DropCollectionReq

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

type DropIndexPropertiesReq

type DropIndexPropertiesReq struct {
	DbName         string   `json:"dbName"`
	CollectionName string   `json:"collectionName" binding:"required"`
	IndexName      string   `json:"indexName" binding:"required"`
	DeleteKeys     []string `json:"deleteKeys"`
}

func (*DropIndexPropertiesReq) GetCollectionName

func (req *DropIndexPropertiesReq) GetCollectionName() string

func (*DropIndexPropertiesReq) GetDbName

func (req *DropIndexPropertiesReq) GetDbName() string

func (*DropIndexPropertiesReq) GetIndexName

func (req *DropIndexPropertiesReq) GetIndexName() string

type EmptyReq

type EmptyReq struct{}

func (*EmptyReq) GetDbName

func (req *EmptyReq) GetDbName() string

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"`
	IsClusteringKey   bool                   `json:"isClusteringKey"`
	ElementTypeParams map[string]interface{} `json:"elementTypeParams" binding:"required"`
	Nullable          bool                   `json:"nullable" binding:"required"`
	DefaultValue      interface{}            `json:"defaultValue" binding:"required"`
}

type FilesGetter

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

type FunctionSchema

type FunctionSchema struct {
	FunctionName     string                 `json:"name" binding:"required"`
	Description      string                 `json:"description"`
	FunctionType     string                 `json:"type" binding:"required"`
	InputFieldNames  []string               `json:"inputFieldNames" binding:"required"`
	OutputFieldNames []string               `json:"outputFieldNames" binding:"required"`
	Params           map[string]interface{} `json:"params"`
}

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"`
}

func (*GrantReq) GetDbName

func (req *GrantReq) GetDbName() string

type GrantV2Req

type GrantV2Req struct {
	RoleName       string `json:"roleName" binding:"required"`
	DbName         string `json:"dbName"`
	CollectionName string `json:"collectionName"`
	Privilege      string `json:"privilege" binding:"required"`
}

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"`
	GroupByField     string         `json:"groupingField"`
	GroupSize        int32          `json:"groupSize"`
	StrictGroupSize  bool           `json:"strictGroupSize"`
	OutputFields     []string       `json:"outputFields"`
	ConsistencyLevel string         `json:"consistencyLevel"`
}

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"`
	MetricType string                 `json:"metricType"`
	IndexType  string                 `json:"indexType"`
	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 IndexReqWithProperties

type IndexReqWithProperties struct {
	DbName         string                 `json:"dbName"`
	CollectionName string                 `json:"collectionName" binding:"required"`
	IndexName      string                 `json:"indexName" binding:"required"`
	Properties     map[string]interface{} `json:"properties"`
}

func (*IndexReqWithProperties) GetCollectionName

func (req *IndexReqWithProperties) GetCollectionName() string

func (*IndexReqWithProperties) GetDbName

func (req *IndexReqWithProperties) GetDbName() string

func (*IndexReqWithProperties) GetIndexName

func (req *IndexReqWithProperties) 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 PrivilegeGroupReq

type PrivilegeGroupReq struct {
	PrivilegeGroupName string   `json:"privilegeGroupName" binding:"required"`
	Privileges         []string `json:"privileges"`
}

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"`
	Limit          int32                  `json:"limit"`
	Offset         int32                  `json:"offset"`
	ExprParams     map[string]interface{} `json:"exprParams"`
}

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 ResourceGroupConfig

type ResourceGroupConfig struct {
	Requests     *ResourceGroupLimit      `json:"requests" binding:"required"`
	Limits       *ResourceGroupLimit      `json:"limits" binding:"required"`
	TransferFrom []*ResourceGroupTransfer `json:"transfer_from"`
	TransferTo   []*ResourceGroupTransfer `json:"transfer_to"`
	NodeFilter   *ResourceGroupNodeFilter `json:"node_filter"`
}

func (*ResourceGroupConfig) GetLimits

func (req *ResourceGroupConfig) GetLimits() *ResourceGroupLimit

func (*ResourceGroupConfig) GetNodeFilter

func (req *ResourceGroupConfig) GetNodeFilter() *ResourceGroupNodeFilter

func (*ResourceGroupConfig) GetRequests

func (req *ResourceGroupConfig) GetRequests() *ResourceGroupLimit

func (*ResourceGroupConfig) GetTransferFrom

func (req *ResourceGroupConfig) GetTransferFrom() []*ResourceGroupTransfer

func (*ResourceGroupConfig) GetTransferTo

func (req *ResourceGroupConfig) GetTransferTo() []*ResourceGroupTransfer

type ResourceGroupLimit

type ResourceGroupLimit struct {
	NodeNum int32 `json:"node_num" binding:"required"`
}

func (*ResourceGroupLimit) GetNodeNum

func (req *ResourceGroupLimit) GetNodeNum() int32

type ResourceGroupNodeFilter

type ResourceGroupNodeFilter struct {
	NodeLabels map[string]string `json:"node_labels" binding:"required"`
}

func (*ResourceGroupNodeFilter) GetNodeLabels

func (req *ResourceGroupNodeFilter) GetNodeLabels() map[string]string

type ResourceGroupReq

type ResourceGroupReq struct {
	Name   string               `json:"name" binding:"required"`
	Config *ResourceGroupConfig `json:"config"`
}

func (*ResourceGroupReq) GetConfig

func (req *ResourceGroupReq) GetConfig() *ResourceGroupConfig

func (*ResourceGroupReq) GetName

func (req *ResourceGroupReq) GetName() string

type ResourceGroupTransfer

type ResourceGroupTransfer struct {
	ResourceGroup string `json:"resource_group" binding:"required"`
}

func (*ResourceGroupTransfer) GetResourceGroup

func (req *ResourceGroupTransfer) GetResourceGroup() 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 {
	DbName   string `json:"dbName"`
	RoleName string `json:"roleName" binding:"required"`
}

func (*RoleReq) GetDbName

func (req *RoleReq) GetDbName() string

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"`
	GroupSize        int32                  `json:"groupSize"`
	StrictGroupSize  bool                   `json:"strictGroupSize"`
	Limit            int32                  `json:"limit"`
	Offset           int32                  `json:"offset"`
	OutputFields     []string               `json:"outputFields"`
	SearchParams     searchParams           `json:"searchParams"`
	ConsistencyLevel string                 `json:"consistencyLevel"`
	ExprParams       map[string]interface{} `json:"exprParams"`
	// not use Params any more, just for compatibility
	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"`
	SearchParams searchParams           `json:"params"`
	ExprParams   map[string]interface{} `json:"exprParams"`
}

type Timeout

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

Timeout struct

type TransferReplicaReq

type TransferReplicaReq struct {
	SourceRgName   string `json:"sourceRgName" binding:"required"`
	TargetRgName   string `json:"targetRgName" binding:"required"`
	CollectionName string `json:"collectionName" binding:"required"`
	ReplicaNum     int64  `json:"replicaNum" binding:"required"`
}

func (*TransferReplicaReq) GetCollectionName

func (req *TransferReplicaReq) GetCollectionName() string

func (*TransferReplicaReq) GetReplicaNum

func (req *TransferReplicaReq) GetReplicaNum() int64

func (*TransferReplicaReq) GetSourceRgName

func (req *TransferReplicaReq) GetSourceRgName() string

func (*TransferReplicaReq) GetTargetRgName

func (req *TransferReplicaReq) GetTargetRgName() string

type UpdateResourceGroupReq

type UpdateResourceGroupReq struct {
	ResourceGroups map[string]*ResourceGroupConfig `json:"resource_groups" binding:"required"`
}

func (*UpdateResourceGroupReq) GetResourceGroups

func (req *UpdateResourceGroupReq) GetResourceGroups() map[string]*ResourceGroupConfig

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