Documentation ¶
Index ¶
- Constants
- Variables
- func AddOne(data string) string
- func After(str string, sub string) string
- func AfterN(str string, sub string, sep string) []string
- func AppendFieldData(dst, src []*schemapb.FieldData, idx int64) (appendSize int64)
- func AppendGroupByValue(dstResData *schemapb.SearchResultData, groupByVal interface{}, ...) error
- func AppendID(dst *schemapb.IDs, src any)
- func AppendIDs(dst *schemapb.IDs, src *schemapb.IDs, idx int)
- func AppendPKs(pks *schemapb.IDs, pk interface{})
- func AppendSystemFields(schema *schemapb.CollectionSchema) *schemapb.CollectionSchema
- func BFloat16BytesToFloat32(b []byte) float32
- func BFloat16BytesToFloat32Vector(b []byte) []float32
- func BigEndianBytesToUint64(b []byte) (uint64, error)
- func BytesToFloat32(bytes []byte) float32
- func BytesToInt64(b []byte) (int64, error)
- func BytesToUint64(b []byte) (uint64, error)
- func CalcColumnSize(column *schemapb.FieldData) int
- func Clone[T proto.Message](msg T) T
- func CompareIndexParams(indexParam1, indexParam2 []*commonpb.KeyValuePair) bool
- func ComparePK(pkA, pkB interface{}) bool
- func ComparePKInSlice(data *schemapb.IDs, i, j int) bool
- func CopyPk(dst *schemapb.IDs, src *schemapb.IDs, offset int)
- func CreateAndSortSparseFloatRow(sparse map[uint32]float32) []byte
- func CreateSparseFloatRow(indices []uint32, values []float32) []byte
- func CreateSparseFloatRowFromJSON(input []byte) ([]byte, error)
- func CreateSparseFloatRowFromMap(input map[string]interface{}) ([]byte, error)
- func DeleteFieldData(dst []*schemapb.FieldData)
- func EstimateAvgSizePerRecord(schema *schemapb.CollectionSchema) (int, error)
- func EstimateEntitySize(fieldsData []*schemapb.FieldData, rowOffset int) (int, error)
- func EstimateMaxSizePerRecord(schema *schemapb.CollectionSchema) (int, error)
- func EstimateSizePerRecord(schema *schemapb.CollectionSchema) (int, error)
- func Float16BytesToFloat32(b []byte) float32
- func Float16BytesToFloat32Vector(b []byte) []float32
- func Float32ToBFloat16Bytes(f float32) []byte
- func Float32ToBytes(float float32) []byte
- func Float32ToFloat16Bytes(f float32) []byte
- func GenEmptyFieldData(field *schemapb.FieldSchema) (*schemapb.FieldData, error)
- func GetData(field *schemapb.FieldData, idx int) interface{}
- func GetDim(field *schemapb.FieldSchema) (int64, error)
- func GetDynamicField(schema *schemapb.CollectionSchema) *schemapb.FieldSchema
- func GetField(schema *schemapb.CollectionSchema, fieldID int64) *schemapb.FieldSchema
- func GetFieldByName(schema *schemapb.CollectionSchema, fieldName string) *schemapb.FieldSchema
- func GetId(src *schemapb.IDs, idx int) (int, any)
- func GetMapKeys(src map[string]string) []string
- func GetPK(data *schemapb.IDs, idx int64) interface{}
- func GetPKSize(fieldData *schemapb.FieldData) int
- func GetPartitionKeyFieldSchema(schema *schemapb.CollectionSchema) (*schemapb.FieldSchema, error)
- func GetPrimaryFieldData(datas []*schemapb.FieldData, primaryFieldSchema *schemapb.FieldSchema) (*schemapb.FieldData, error)
- func GetPrimaryFieldSchema(schema *schemapb.CollectionSchema) (*schemapb.FieldSchema, error)
- func GetSizeOfIDs(data *schemapb.IDs) int
- func GetVectorFieldSchema(schema *schemapb.CollectionSchema) (*schemapb.FieldSchema, error)
- func GetVectorFieldSchemas(schema *schemapb.CollectionSchema) []*schemapb.FieldSchema
- func HasClusterKey(schema *schemapb.CollectionSchema) bool
- func HasPartitionKey(schema *schemapb.CollectionSchema) bool
- func Hash32Bytes(b []byte) (uint32, error)
- func Hash32Int64(v int64) (uint32, error)
- func Hash32String(s string) (int64, error)
- func Hash32Uint64(v uint64) (uint32, error)
- func HashKey2Partitions(keys *schemapb.FieldData, partitionNames []string) ([]uint32, error)
- func HashPK2Channels(primaryKeys *schemapb.IDs, shardNames []string) []uint32
- func HashString2Uint32(v string) uint32
- func Int64ToBytes(v int64) []byte
- func IsArithmetic(dataType schemapb.DataType) bool
- func IsArrayType(dataType schemapb.DataType) bool
- func IsAutoPKField(field *schemapb.FieldSchema) bool
- func IsBinaryVectorType(dataType schemapb.DataType) bool
- func IsBoolType(dataType schemapb.DataType) bool
- func IsChanClosed(ch <-chan struct{}) bool
- func IsDenseFloatVectorType(dataType schemapb.DataType) bool
- func IsFieldDataTypeSupportMaterializedView(fieldSchema *schemapb.FieldSchema) bool
- func IsFixDimVectorType(dataType schemapb.DataType) bool
- func IsFloatVectorType(dataType schemapb.DataType) bool
- func IsFloatingType(dataType schemapb.DataType) bool
- func IsIntegerType(dataType schemapb.DataType) bool
- func IsJSONType(dataType schemapb.DataType) bool
- func IsPrimaryFieldDataExist(datas []*schemapb.FieldData, primaryFieldSchema *schemapb.FieldSchema) bool
- func IsPrimaryFieldType(dataType schemapb.DataType) bool
- func IsPrimitiveType(dataType schemapb.DataType) bool
- func IsSparseFloatVectorType(dataType schemapb.DataType) bool
- func IsStringType(dataType schemapb.DataType) bool
- func IsVariableDataType(dataType schemapb.DataType) bool
- func IsVectorType(dataType schemapb.DataType) bool
- func MapEqual(left, right map[int64]int64) bool
- func MergeFieldData(dst []*schemapb.FieldData, src []*schemapb.FieldData) error
- func MergeMap(src map[string]string, dst map[string]string) map[string]string
- func NewKvPairs(pairs []*commonpb.KeyValuePair) *kvPairsHelper[string, string]
- func ParseTimestamp(data []byte) (time.Time, error)
- func PrepareResultFieldData(sample []*schemapb.FieldData, topK int64) []*schemapb.FieldData
- func RearrangePartitionsForPartitionKey(partitions map[string]int64) ([]string, []int64, error)
- func SelectMinPK[T ResultWithID](results []T, cursors []int64) (int, bool)
- func SelectMinPKWithTimestamp[T interface{ ... }](results []T, cursors []int64) (int, bool)
- func ServerTypeList() []string
- func SliceRemoveDuplicate(a interface{}) (ret []interface{})
- func SortSparseFloatRow(indices []uint32, values []float32) ([]uint32, []float32)
- func SparseFloatBytesToMap(b []byte) map[uint32]float32
- func SparseFloatRowDim(row []byte) int64
- func SparseFloatRowElementCount(row []byte) int
- func SparseFloatRowIndexAt(row []byte, idx int) uint32
- func SparseFloatRowSetAt(row []byte, pos int, idx uint32, value float32)
- func SparseFloatRowValueAt(row []byte, idx int) float32
- func SubTimeByWallClock(after, before time.Time) time.Duration
- func SwapPK(data *schemapb.IDs, i, j int)
- func TimestampToString(ts uint64) string
- func Uint64ToBytes(v uint64) []byte
- func Uint64ToBytesBigEndian(v uint64) []byte
- func UnsafeBytes2str(b []byte) string
- func UnsafeStr2bytes(s string) []byte
- func ValidateSparseFloatRows(rows ...[]byte) error
- func VectorTypeSize(dataType schemapb.DataType) float64
- func VerifyBFloats16(value []byte) error
- func VerifyFloat(value float64) error
- func VerifyFloats16(value []byte) error
- func VerifyFloats32(values []float32) error
- func VerifyFloats64(values []float64) error
- type BackoffConfig
- type BackoffTimer
- type BackoffTimerConfig
- type BackoffTimerConfigFetcher
- type CacheOp
- type CacheOpType
- type Closable
- type ConcurrentMap
- func (m *ConcurrentMap[K, V]) Contain(key K) bool
- func (m *ConcurrentMap[K, V]) Get(key K) (V, bool)
- func (m *ConcurrentMap[K, V]) GetAndRemove(key K) (V, bool)
- func (m *ConcurrentMap[K, V]) GetOrInsert(key K, value V) (V, bool)
- func (m *ConcurrentMap[K, V]) Insert(key K, value V)
- func (m *ConcurrentMap[K, V]) Keys() []K
- func (m *ConcurrentMap[K, V]) Len() int
- func (m *ConcurrentMap[K, V]) Range(f func(key K, value V) bool)
- func (m *ConcurrentMap[K, V]) Remove(key K)
- func (m *ConcurrentMap[K, V]) Values() []V
- type ConcurrentSet
- func (set *ConcurrentSet[T]) Collect() []T
- func (set *ConcurrentSet[T]) Contain(elements ...T) bool
- func (set *ConcurrentSet[T]) Insert(element T) bool
- func (set *ConcurrentSet[T]) Range(f func(element T) bool)
- func (set *ConcurrentSet[T]) Remove(elements ...T)
- func (set *ConcurrentSet[T]) TryRemove(element T) bool
- func (set *ConcurrentSet[T]) Upsert(elements ...T)
- type FieldSchemaHelper
- type GenericSchemaSlice
- type Heap
- type HeapInterface
- type IDAllocator
- type IntPrimaryKey
- type MultipartQueue
- type OrderedMap
- type Pair
- type ResultWithID
- type ResultWithTimestamp
- type SchemaHelper
- func (helper *SchemaHelper) GetClusteringKeyField() (*schemapb.FieldSchema, error)
- func (helper *SchemaHelper) GetCollectionName() string
- func (helper *SchemaHelper) GetDynamicField() (*schemapb.FieldSchema, error)
- func (helper *SchemaHelper) GetFieldFromID(fieldID int64) (*schemapb.FieldSchema, error)
- func (helper *SchemaHelper) GetFieldFromName(fieldName string) (*schemapb.FieldSchema, error)
- func (helper *SchemaHelper) GetFieldFromNameDefaultJSON(fieldName string) (*schemapb.FieldSchema, error)
- func (helper *SchemaHelper) GetFunctionByOutputField(field *schemapb.FieldSchema) (*schemapb.FunctionSchema, error)
- func (helper *SchemaHelper) GetPartitionKeyField() (*schemapb.FieldSchema, error)
- func (helper *SchemaHelper) GetPrimaryKeyField() (*schemapb.FieldSchema, error)
- func (helper *SchemaHelper) GetVectorDimFromID(fieldID int64) (int, error)
- func (helper *SchemaHelper) IsFieldLoaded(fieldID int64) bool
- type Set
- func (set Set[T]) Clear()
- func (set Set[T]) Clone() Set[T]
- func (set Set[T]) Collect() []T
- func (set Set[T]) Complement(other Set[T]) Set[T]
- func (set Set[T]) Contain(elements ...T) bool
- func (set Set[T]) Insert(elements ...T)
- func (set Set[T]) Intersection(other Set[T]) Set[T]
- func (set Set[T]) Len() int
- func (set Set[T]) Range(f func(element T) bool)
- func (set Set[T]) Remove(elements ...T)
- func (set Set[T]) Union(other Set[T]) Set[T]
- type SharedReference
- type SkipList
- type SkipListOption
- type Timestamp
- type UniqueID
- type UniqueSet
- type Version
- type VersionInt64
- type VersionInt64Pair
- type WeakReference
Constants ¶
const ( // EmbeddedRole is for embedded Milvus. EmbeddedRole = "embedded" // StandaloneRole is a constant represent Standalone StandaloneRole = "standalone" // RootCoordRole is a constant represent RootCoord RootCoordRole = "rootcoord" // ProxyRole is a constant represent Proxy ProxyRole = "proxy" // QueryCoordRole is a constant represent QueryCoord QueryCoordRole = "querycoord" // QueryNodeRole is a constant represent QueryNode QueryNodeRole = "querynode" // IndexCoordRole is a constant represent IndexCoord IndexCoordRole = "indexcoord" // IndexNodeRole is a constant represent IndexNode DataCoordRole = "datacoord" // DataNodeRole is a constant represent DataNode DataNodeRole = "datanode" // IndexNodeRole is a constant represent IndexNode IndexNodeRole = "indexnode" // MixtureRole is a constant represents Mixture running modtoe MixtureRole = "mixture" // StreamingCoord is a constant represent StreamingCoord StreamingCoordRole = "streamingcoord" // StreamingNode is a constant represent StreamingNode StreamingNodeRole = "streamingnode" )
const DynamicFieldMaxLength = 512
const MaxTimestamp = Timestamp(math.MaxUint64)
MaxTimestamp is the max timestamp.
const Unlimited int64 = -1
Variables ¶
var ZeroTime = time.Time{}
ZeroTime is a zero time.
var ZeroTimestamp = Timestamp(0)
ZeroTimestamp is a zero timestamp
Functions ¶
func AddOne ¶
AddOne add one to last byte in string, on empty string return empty it helps with key iteration upper bound
func AppendFieldData ¶
AppendFieldData appends fields data of specified index from src to dst
func AppendGroupByValue ¶
func AppendGroupByValue(dstResData *schemapb.SearchResultData, groupByVal interface{}, srcDataType schemapb.DataType, ) error
func AppendSystemFields ¶
func AppendSystemFields(schema *schemapb.CollectionSchema) *schemapb.CollectionSchema
func BFloat16BytesToFloat32 ¶
func BigEndianBytesToUint64 ¶
BigEndianBytesToUint64 converts a byte slice (big endian) to uint64.
func BytesToFloat32 ¶
BytesToFloat32 converts a byte slice to float32.
func BytesToInt64 ¶
BytesToInt64 converts a byte slice to uint64.
func BytesToUint64 ¶
BytesToUint64 converts a byte slice to uint64.
func CalcColumnSize ¶
func CompareIndexParams ¶
func CompareIndexParams(indexParam1, indexParam2 []*commonpb.KeyValuePair) bool
CompareIndexParams compares indexParam1 with indexParam2. When all keys of indexParam1 exist in indexParam2, and the corresponding value are the same as in indexParam2, return true Otherwise return false
func ComparePK ¶
func ComparePK(pkA, pkB interface{}) bool
ComparePK returns if i-th PK of dataA > j-th PK of dataB
func ComparePKInSlice ¶
ComparePKInSlice returns if i-th PK < j-th PK
func CreateSparseFloatRow ¶
func CreateSparseFloatRowFromMap ¶
accepted format:
- {"indices": [1, 2, 3], "values": [0.1, 0.2, 0.3]} # format1
- {"1": 0.1, "2": 0.2, "3": 0.3} # format2
we don't require the indices to be sorted from user input, but the returned byte representation must have indices sorted
func DeleteFieldData ¶
DeleteFieldData delete fields data appended last time
func EstimateAvgSizePerRecord ¶
func EstimateAvgSizePerRecord(schema *schemapb.CollectionSchema) (int, error)
func EstimateEntitySize ¶
func EstimateMaxSizePerRecord ¶
func EstimateMaxSizePerRecord(schema *schemapb.CollectionSchema) (int, error)
func EstimateSizePerRecord ¶
func EstimateSizePerRecord(schema *schemapb.CollectionSchema) (int, error)
EstimateSizePerRecord returns the estimate size of a record in a collection
func Float16BytesToFloat32 ¶
func Float32ToBFloat16Bytes ¶
func Float32ToBytes ¶
Float32ToBytes converts a float to byte slice.
func Float32ToFloat16Bytes ¶
func GenEmptyFieldData ¶
func GenEmptyFieldData(field *schemapb.FieldSchema) (*schemapb.FieldData, error)
func GetDim ¶
func GetDim(field *schemapb.FieldSchema) (int64, error)
GetDim get dimension of field. Maybe also helpful outside.
func GetDynamicField ¶
func GetDynamicField(schema *schemapb.CollectionSchema) *schemapb.FieldSchema
GetDynamicField returns the dynamic field if it exists.
func GetField ¶
func GetField(schema *schemapb.CollectionSchema, fieldID int64) *schemapb.FieldSchema
func GetFieldByName ¶
func GetFieldByName(schema *schemapb.CollectionSchema, fieldName string) *schemapb.FieldSchema
func GetPartitionKeyFieldSchema ¶
func GetPartitionKeyFieldSchema(schema *schemapb.CollectionSchema) (*schemapb.FieldSchema, error)
GetPartitionKeyFieldSchema get partition field schema from collection schema
func GetPrimaryFieldData ¶
func GetPrimaryFieldData(datas []*schemapb.FieldData, primaryFieldSchema *schemapb.FieldSchema) (*schemapb.FieldData, error)
GetPrimaryFieldData get primary field data from all field data inserted from sdk
func GetPrimaryFieldSchema ¶
func GetPrimaryFieldSchema(schema *schemapb.CollectionSchema) (*schemapb.FieldSchema, error)
GetPrimaryFieldSchema get primary field schema from collection schema
func GetSizeOfIDs ¶
func GetVectorFieldSchema ¶
func GetVectorFieldSchema(schema *schemapb.CollectionSchema) (*schemapb.FieldSchema, error)
GetVectorFieldSchema get vector field schema from collection schema.
func GetVectorFieldSchemas ¶
func GetVectorFieldSchemas(schema *schemapb.CollectionSchema) []*schemapb.FieldSchema
GetVectorFieldSchemas get vector fields schema from collection schema.
func HasClusterKey ¶
func HasClusterKey(schema *schemapb.CollectionSchema) bool
HasClusterKey check if a collection schema has ClusterKey field
func HasPartitionKey ¶
func HasPartitionKey(schema *schemapb.CollectionSchema) bool
HasPartitionKey check if a collection schema has PartitionKey field
func Hash32Bytes ¶
Hash32Bytes hashing a byte array to uint32
func Hash32Int64 ¶
Hash32Int64 hashing an int64 number to uint32
func Hash32String ¶
Hash32String hashing a string to int64
func Hash32Uint64 ¶
Hash32Uint64 hashing an uint64 nubmer to uint32
func HashKey2Partitions ¶
HashKey2Partitions hash partition keys to partitions
func HashPK2Channels ¶
HashPK2Channels hash primary keys to channels
func HashString2Uint32 ¶
HashString2Uint32 hashing a string to uint32
func IsArithmetic ¶
IsArithmetic returns true if input is of arithmetic type, otherwise false.
func IsArrayType ¶
func IsAutoPKField ¶
func IsAutoPKField(field *schemapb.FieldSchema) bool
func IsBinaryVectorType ¶
func IsBoolType ¶
IsBoolType returns true if input is a bool type, otherwise false
func IsChanClosed ¶
func IsChanClosed(ch <-chan struct{}) bool
IsChanClosed returns whether input signal channel is closed or not. this method accept `chan struct{}` type only in case of passing msg channels by mistake.
func IsDenseFloatVectorType ¶
func IsFieldDataTypeSupportMaterializedView ¶
func IsFieldDataTypeSupportMaterializedView(fieldSchema *schemapb.FieldSchema) bool
func IsFixDimVectorType ¶
func IsFloatVectorType ¶
func IsFloatingType ¶
IsFloatingType returns true if input is a floating type, otherwise false
func IsIntegerType ¶
IsIntegerType returns true if input is an integer type, otherwise false
func IsJSONType ¶
func IsPrimaryFieldDataExist ¶
func IsPrimaryFieldDataExist(datas []*schemapb.FieldData, primaryFieldSchema *schemapb.FieldSchema) bool
func IsPrimaryFieldType ¶
func IsPrimitiveType ¶
func IsSparseFloatVectorType ¶
func IsStringType ¶
IsStringType returns true if input is a varChar type, otherwise false
func IsVariableDataType ¶
func IsVectorType ¶
IsVectorType returns true if input is a vector type, otherwise false
func MergeFieldData ¶
MergeFieldData appends fields data to dst
func NewKvPairs ¶
func NewKvPairs(pairs []*commonpb.KeyValuePair) *kvPairsHelper[string, string]
func ParseTimestamp ¶
ParseTimestamp returns a timestamp for a given byte slice.
func PrepareResultFieldData ¶
PrepareResultFieldData construct this slice fo FieldData for final result reduce this shall preallocate the space for field data internal slice prevent slice growing cost.
func RearrangePartitionsForPartitionKey ¶
this method returns a static sequence for partitions for partiton key mode
func SelectMinPK ¶
func SelectMinPK[T ResultWithID](results []T, cursors []int64) (int, bool)
SelectMinPK select the index of the minPK in results T of the cursors.
func SelectMinPKWithTimestamp ¶
func SelectMinPKWithTimestamp[T interface { ResultWithID ResultWithTimestamp }](results []T, cursors []int64) (int, bool)
func ServerTypeList ¶
func ServerTypeList() []string
func SliceRemoveDuplicate ¶
func SliceRemoveDuplicate(a interface{}) (ret []interface{})
SliceRemoveDuplicate is used to dedup a Slice
func SortSparseFloatRow ¶
func SparseFloatBytesToMap ¶
func SparseFloatRowDim ¶
dim of a sparse float vector is the maximum/last index + 1. for an empty row, dim is 0.
func SparseFloatRowElementCount ¶
SparseFloatRowUtils
func SparseFloatRowIndexAt ¶
does not check for out-of-range access
func SparseFloatRowValueAt ¶
does not check for out-of-range access
func SubTimeByWallClock ¶
SubTimeByWallClock returns the duration between two different timestamps.
func TimestampToString ¶
func Uint64ToBytes ¶
Uint64ToBytes converts uint64 to a byte slice.
func Uint64ToBytesBigEndian ¶
Uint64ToBytesBigEndian converts uint64 to a byte slice(big endian).
func ValidateSparseFloatRows ¶
func VectorTypeSize ¶
return VectorTypeSize for each dim (byte)
func VerifyBFloats16 ¶
func VerifyFloat ¶
func VerifyFloats16 ¶
func VerifyFloats32 ¶
func VerifyFloats64 ¶
Types ¶
type BackoffConfig ¶
type BackoffConfig struct { InitialInterval time.Duration Multiplier float64 MaxInterval time.Duration }
BackoffConfig is the configuration for backoff
type BackoffTimer ¶
type BackoffTimer struct {
// contains filtered or unexported fields
}
BackoffTimer is a timer for balance operation
func NewBackoffTimer ¶
func NewBackoffTimer(configFetcher BackoffTimerConfigFetcher) *BackoffTimer
NewBackoffTimer creates a new balanceTimer
func (*BackoffTimer) DisableBackoff ¶
func (t *BackoffTimer) DisableBackoff()
DisableBackoff disables the backoff
func (*BackoffTimer) EnableBackoff ¶
func (t *BackoffTimer) EnableBackoff()
EnableBackoff enables the backoff
func (*BackoffTimer) IsBackoffStopped ¶
func (t *BackoffTimer) IsBackoffStopped() bool
IsBackoffStopped returns the elapsed time of backoff
func (*BackoffTimer) NextInterval ¶
func (t *BackoffTimer) NextInterval() time.Duration
NextInterval returns the next interval
type BackoffTimerConfig ¶
type BackoffTimerConfig struct { Default time.Duration Backoff BackoffConfig }
BackoffTimerConfig is the configuration for backoff timer It's also used to be const config fetcher. Every DefaultInterval is a fetch loop.
func (BackoffTimerConfig) BackoffConfig ¶
func (c BackoffTimerConfig) BackoffConfig() BackoffConfig
func (BackoffTimerConfig) DefaultInterval ¶
func (c BackoffTimerConfig) DefaultInterval() time.Duration
type BackoffTimerConfigFetcher ¶
type BackoffTimerConfigFetcher interface { DefaultInterval() time.Duration BackoffConfig() BackoffConfig }
BackoffTimerConfigFetcher is the interface to fetch backoff timer configuration
type CacheOp ¶
type CacheOp struct { OpType CacheOpType OpKey string }
type CacheOpType ¶
type CacheOpType int32
const ( CacheAddUserToRole CacheOpType = iota + 1 CacheRemoveUserFromRole CacheGrantPrivilege CacheRevokePrivilege CacheDeleteUser CacheDropRole CacheRefresh )
type Closable ¶
type Closable interface {
Close()
}
Closable is an interface that can be closed or release the resource.
type ConcurrentMap ¶
type ConcurrentMap[K comparable, V any] struct { // contains filtered or unexported fields }
func NewConcurrentMap ¶
func NewConcurrentMap[K comparable, V any]() *ConcurrentMap[K, V]
func (*ConcurrentMap[K, V]) Contain ¶
func (m *ConcurrentMap[K, V]) Contain(key K) bool
func (*ConcurrentMap[K, V]) Get ¶
func (m *ConcurrentMap[K, V]) Get(key K) (V, bool)
func (*ConcurrentMap[K, V]) GetAndRemove ¶
func (m *ConcurrentMap[K, V]) GetAndRemove(key K) (V, bool)
func (*ConcurrentMap[K, V]) GetOrInsert ¶
func (m *ConcurrentMap[K, V]) GetOrInsert(key K, value V) (V, bool)
GetOrInsert returns the `value` and `loaded` on the given `key`, `value` set. If the key already exists, return the value and set `loaded` to true. If the key does not exist, insert the given `key` and `value` to map, return the value and set `loaded` to false.
func (*ConcurrentMap[K, V]) Insert ¶
func (m *ConcurrentMap[K, V]) Insert(key K, value V)
Insert inserts the key-value pair to the concurrent map
func (*ConcurrentMap[K, V]) Keys ¶
func (m *ConcurrentMap[K, V]) Keys() []K
func (*ConcurrentMap[K, V]) Len ¶
func (m *ConcurrentMap[K, V]) Len() int
func (*ConcurrentMap[K, V]) Range ¶
func (m *ConcurrentMap[K, V]) Range(f func(key K, value V) bool)
func (*ConcurrentMap[K, V]) Remove ¶
func (m *ConcurrentMap[K, V]) Remove(key K)
Remove removes the `key`, `value` set if `key` is in the map, does nothing if `key` not in the map.
func (*ConcurrentMap[K, V]) Values ¶
func (m *ConcurrentMap[K, V]) Values() []V
type ConcurrentSet ¶
type ConcurrentSet[T comparable] struct { // contains filtered or unexported fields }
func NewConcurrentSet ¶
func NewConcurrentSet[T comparable]() *ConcurrentSet[T]
func (*ConcurrentSet[T]) Collect ¶
func (set *ConcurrentSet[T]) Collect() []T
Get all elements in the set
func (*ConcurrentSet[T]) Contain ¶
func (set *ConcurrentSet[T]) Contain(elements ...T) bool
Check whether the elements exist
func (*ConcurrentSet[T]) Insert ¶
func (set *ConcurrentSet[T]) Insert(element T) bool
func (*ConcurrentSet[T]) Range ¶
func (set *ConcurrentSet[T]) Range(f func(element T) bool)
func (*ConcurrentSet[T]) Remove ¶
func (set *ConcurrentSet[T]) Remove(elements ...T)
Remove elements from the set, do nothing if set is nil or id not exists
func (*ConcurrentSet[T]) TryRemove ¶
func (set *ConcurrentSet[T]) TryRemove(element T) bool
Try remove element from set, return false if not exist
func (*ConcurrentSet[T]) Upsert ¶
func (set *ConcurrentSet[T]) Upsert(elements ...T)
Insert elements into the set, do nothing if the id existed
type FieldSchemaHelper ¶
type FieldSchemaHelper struct {
// contains filtered or unexported fields
}
func CreateFieldSchemaHelper ¶
func CreateFieldSchemaHelper(schema *schemapb.FieldSchema) *FieldSchemaHelper
func (*FieldSchemaHelper) EnableAnalyzer ¶
func (h *FieldSchemaHelper) EnableAnalyzer() bool
func (*FieldSchemaHelper) EnableMatch ¶
func (h *FieldSchemaHelper) EnableMatch() bool
func (*FieldSchemaHelper) GetDim ¶
func (h *FieldSchemaHelper) GetDim() (int64, error)
type GenericSchemaSlice ¶
func NewInt64PkSchemaSlice ¶
func NewInt64PkSchemaSlice(data *schemapb.IDs) GenericSchemaSlice[int64]
func NewStringPkSchemaSlice ¶
func NewStringPkSchemaSlice(data *schemapb.IDs) GenericSchemaSlice[string]
type Heap ¶
type Heap[E any] interface { // Len returns the size of the heap. Len() int // Push pushes an element onto the heap. Push(x E) // Pop returns the element at the top of the heap. // Panics if the heap is empty. Pop() E // Peek returns the element at the top of the heap. // Panics if the heap is empty. Peek() E }
Heap is a heap of E. Use `golang.org/x/exp/constraints` directly if you want to change any element.
func NewArrayBasedMaximumHeap ¶
func NewArrayBasedMaximumHeap[E constraints.Ordered](initial []E) Heap[E]
NewArrayBasedMaximumHeap returns a new maximum heap.
func NewArrayBasedMinimumHeap ¶
func NewArrayBasedMinimumHeap[E constraints.Ordered](initial []E) Heap[E]
NewArrayBasedMinimumHeap returns a new minimum heap.
func NewHeap ¶
func NewHeap[E any](inner HeapInterface) Heap[E]
NewHeap returns a new heap from a underlying representation.
type HeapInterface ¶
HeapInterface is the interface that a heap must implement.
type IDAllocator ¶
type IDAllocator struct {
// contains filtered or unexported fields
}
IDAllocator is a thread-safe ID allocator.
func (*IDAllocator) Allocate ¶
func (ida *IDAllocator) Allocate() int64
Allocate allocates a new ID.
type MultipartQueue ¶
type MultipartQueue[T any] struct { // contains filtered or unexported fields }
MultipartQueue is a multi-part queue.
func NewMultipartQueue ¶
func NewMultipartQueue[T any]() *MultipartQueue[T]
NewMultipartQueue create a new multi-part queue.
func (*MultipartQueue[T]) Add ¶
func (pq *MultipartQueue[T]) Add(msgs []T)
Add add a slice of message as pending one
func (*MultipartQueue[T]) AddOne ¶
func (pq *MultipartQueue[T]) AddOne(msg T)
AddOne add a message as pending one
func (*MultipartQueue[T]) Next ¶
func (pq *MultipartQueue[T]) Next() T
Next return the next message in pending queue.
func (*MultipartQueue[T]) UnsafeAdvance ¶
func (pq *MultipartQueue[T]) UnsafeAdvance()
UnsafeAdvance do a advance without check. !!! Should only be called `Next` do not return nil.
type OrderedMap ¶
type OrderedMap[K comparable, V any] struct { // contains filtered or unexported fields }
func NewOrderedMap ¶
func NewOrderedMap[K comparable, V any]() *OrderedMap[K, V]
func (*OrderedMap[K, V]) Delete ¶
func (o *OrderedMap[K, V]) Delete(key K)
func (*OrderedMap[K, V]) Get ¶
func (o *OrderedMap[K, V]) Get(key K) (V, bool)
func (*OrderedMap[K, V]) Keys ¶
func (o *OrderedMap[K, V]) Keys() []K
func (*OrderedMap[K, V]) Set ¶
func (o *OrderedMap[K, V]) Set(key K, value V)
func (*OrderedMap[K, V]) SortKeys ¶
func (o *OrderedMap[K, V]) SortKeys(sortFunc func(keys []K))
SortKeys Sort the map keys using your sort func
type ResultWithID ¶
type ResultWithTimestamp ¶
type ResultWithTimestamp interface {
GetTimestamps() []int64
}
type SchemaHelper ¶
type SchemaHelper struct {
// contains filtered or unexported fields
}
SchemaHelper provides methods to get the schema of fields
func CreateSchemaHelper ¶
func CreateSchemaHelper(schema *schemapb.CollectionSchema) (*SchemaHelper, error)
CreateSchemaHelper returns a new SchemaHelper object
func CreateSchemaHelperWithLoadFields ¶
func CreateSchemaHelperWithLoadFields(schema *schemapb.CollectionSchema, loadFields []int64) (*SchemaHelper, error)
func (*SchemaHelper) GetClusteringKeyField ¶
func (helper *SchemaHelper) GetClusteringKeyField() (*schemapb.FieldSchema, error)
GetClusteringKeyField returns the schema of the clustering key. If not found, an error shall be returned.
func (*SchemaHelper) GetCollectionName ¶
func (helper *SchemaHelper) GetCollectionName() string
func (*SchemaHelper) GetDynamicField ¶
func (helper *SchemaHelper) GetDynamicField() (*schemapb.FieldSchema, error)
GetDynamicField returns the field schema of dynamic field if exists. if there is no dynamic field defined in schema, error will be returned.
func (*SchemaHelper) GetFieldFromID ¶
func (helper *SchemaHelper) GetFieldFromID(fieldID int64) (*schemapb.FieldSchema, error)
GetFieldFromID returns the schema of specified field
func (*SchemaHelper) GetFieldFromName ¶
func (helper *SchemaHelper) GetFieldFromName(fieldName string) (*schemapb.FieldSchema, error)
GetFieldFromName is used to find the schema by field name
func (*SchemaHelper) GetFieldFromNameDefaultJSON ¶
func (helper *SchemaHelper) GetFieldFromNameDefaultJSON(fieldName string) (*schemapb.FieldSchema, error)
GetFieldFromNameDefaultJSON is used to find the schema by field name, if not exist, use json field
func (*SchemaHelper) GetFunctionByOutputField ¶
func (helper *SchemaHelper) GetFunctionByOutputField(field *schemapb.FieldSchema) (*schemapb.FunctionSchema, error)
func (*SchemaHelper) GetPartitionKeyField ¶
func (helper *SchemaHelper) GetPartitionKeyField() (*schemapb.FieldSchema, error)
GetPartitionKeyField returns the schema of the partition key
func (*SchemaHelper) GetPrimaryKeyField ¶
func (helper *SchemaHelper) GetPrimaryKeyField() (*schemapb.FieldSchema, error)
GetPrimaryKeyField returns the schema of the primary key
func (*SchemaHelper) GetVectorDimFromID ¶
func (helper *SchemaHelper) GetVectorDimFromID(fieldID int64) (int, error)
GetVectorDimFromID returns the dimension of specified field
func (*SchemaHelper) IsFieldLoaded ¶
func (helper *SchemaHelper) IsFieldLoaded(fieldID int64) bool
GetFieldFromNameDefaultJSON returns whether is field loaded. If load fields is not provided, treated as loaded
type Set ¶
type Set[T comparable] map[T]struct{}
func NewSet ¶
func NewSet[T comparable](elements ...T) Set[T]
func ServerTypeSet ¶
func (Set[T]) Complement ¶
Complement returns the complement with the given set
func (Set[T]) Insert ¶
func (set Set[T]) Insert(elements ...T)
Insert elements into the set, do nothing if the id existed
func (Set[T]) Intersection ¶
Intersection returns the intersection with the given set
type SharedReference ¶
type SharedReference[T Closable] struct { // contains filtered or unexported fields }
SharedReference is a reference type that can be shared with only one close operation. Without supported of determined destructor, A safe SharedReference is rely on user's behavior.
func NewSharedReference ¶
func NewSharedReference[T Closable](inner T) *SharedReference[T]
NewSharedReference creates a new SharedReference with the inner object.
func (*SharedReference[T]) Clone ¶
func (sr *SharedReference[T]) Clone() *SharedReference[T]
Clone returns a new SharedReference with the same inner object. Clone should only be called if the reference is not closed. Otherwise UB happens.
func (*SharedReference[T]) Close ¶
func (sr *SharedReference[T]) Close()
Close closes the reference, should only be called once at a sharedReference. After called this method, all other method of the SharedReference should not be called any more. if the reference count is 0, the inner object will be closed.
func (*SharedReference[T]) Deref ¶
func (sr *SharedReference[T]) Deref() T
Deref returns the inner object. Deref should only be called if the reference is not closed. Otherwise UB happens.
func (*SharedReference[T]) Downgrade ¶
func (sr *SharedReference[T]) Downgrade() *WeakReference[T]
Downgrade returns a new WeakReference with the same inner object. After downgrade, the SharedReference can not be used.
type SkipList ¶
type SkipList[K constraints.Ordered, V any] struct { // contains filtered or unexported fields }
SkipList generic skip list. with extra truncate and traverse-after feature.
func NewSkipList ¶
func NewSkipList[K constraints.Ordered, V any](opts ...SkipListOption) (*SkipList[K, V], error)
NewSkipList creates a new SkipList with provided option.
func (*SkipList[K, V]) ListAfter ¶
ListAfter returns values after provided key. include indicates value related to key is returned or not.
func (*SkipList[K, V]) TruncateBefore ¶
func (sl *SkipList[K, V]) TruncateBefore(key K)
TruncateBefore truncates elements before key.
type SkipListOption ¶
type SkipListOption func(opt *skipListOpt)
SkipListOption setup function alias.
func WithMaxLevel ¶
func WithMaxLevel(maxLevel int) SkipListOption
WithMaxLevel returns SkipListOption to setup max level.
func WithSkip ¶
func WithSkip(skip int) SkipListOption
WithSkip returns SkipListOption to setup skip.
type UniqueSet ¶
UniqueSet is set type, which contains only UniqueIDs, the underlying type is map[UniqueID]struct{}. Create a UniqueSet instance with make(UniqueSet) like creating a map instance.
func NewUniqueSet ¶
type Version ¶
type Version interface { // GT returns true if v > v2. GT(Version) bool // EQ returns true if v == v2. EQ(Version) bool }
Version is a interface for version comparison.
type VersionInt64 ¶
type VersionInt64 int64
VersionInt64 is a int64 type version.
func (VersionInt64) EQ ¶
func (v VersionInt64) EQ(v2 Version) bool
func (VersionInt64) GT ¶
func (v VersionInt64) GT(v2 Version) bool
type VersionInt64Pair ¶
VersionInt64Pair is a pair of int64 type version. It's easy to be used in multi node version comparison.
func (VersionInt64Pair) EQ ¶
func (v VersionInt64Pair) EQ(v2 Version) bool
func (VersionInt64Pair) GT ¶
func (v VersionInt64Pair) GT(v2 Version) bool
type WeakReference ¶
type WeakReference[T Closable] struct { // contains filtered or unexported fields }
WeakReference is a weak reference type that can be shared with only one close operation.
func (*WeakReference[T]) Upgrade ¶
func (wr *WeakReference[T]) Upgrade() *SharedReference[T]
Source Files ¶
- backoff_timer.go
- cache.go
- chan.go
- convension.go
- field_schema.go
- float_util.go
- gen_empty_field_data.go
- get_dim.go
- hash.go
- heap.go
- id_allocator.go
- index.go
- kv_pair_helper.go
- map.go
- multipart_queue.go
- ordered_map.go
- pair.go
- schema.go
- schema_typed.go
- set.go
- shared_reference.go
- skip_list.go
- string_util.go
- time.go
- type.go
- version.go