Documentation ¶
Overview ¶
Licensed to the LF AI & Data foundation under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func CheckCtxValid(ctx context.Context) bool
- func CheckGrpcReady(ctx context.Context, targetCh chan error)
- func CheckPortAvailable(port int) bool
- func CombineObjectName(dbName string, objectName string) string
- func ConvertChannelName(chanName string, tokenFrom string, tokenTo string) (string, error)
- func ConvertToKeyValuePairPointer(datas []commonpb.KeyValuePair) []*commonpb.KeyValuePair
- func DecodeUserRoleCache(cache string) (string, string, error)
- func EncodeUserRoleCache(user string, role string) string
- func FieldDataToPlaceholderGroupBytes(fieldData *schemapb.FieldData) ([]byte, error)
- func GenChannelSubName(prefix string, collectionID int64, nodeID int64) string
- func GenRandomBytes() []byte
- func GenRandomBytesWithLength(length int64) []byte
- func GenRandomStr() string
- func GetAttrByKeyFromRepeatedKV(key string, kvs []*commonpb.KeyValuePair) (string, error)
- func GetAvailablePort() int
- func GetCollectionIDFromVChannel(vChannelName string) int64
- func GetFunctionName(i interface{}) string
- func GetIP(ip string) string
- func GetLocalIP() string
- func GetNumRowOfFieldData(fieldData *schemapb.FieldData) (uint64, error)
- func GetNumRowOfFieldDataWithSchema(fieldData *schemapb.FieldData, helper *typeutil.SchemaHelper) (uint64, error)
- func GetNumRowsOfBFloat16VectorField(bf16Datas []byte, dim int64) (uint64, error)
- func GetNumRowsOfBinaryVectorField(bDatas []byte, dim int64) (uint64, error)
- func GetNumRowsOfFloat16VectorField(f16Datas []byte, dim int64) (uint64, error)
- func GetNumRowsOfFloatVectorField(fDatas []float32, dim int64) (uint64, error)
- func GetObjectName(m interface{}, index int32) string
- func GetObjectNames(m interface{}, index int32) []string
- func GetPrivilegeExtObj(m interface{}) (commonpb.PrivilegeExt, error)
- func GetValidLocalIP(addrs []net.Addr) string
- func GetVecFieldIDs(schema *schemapb.CollectionSchema) []int64
- func GetVersion(m interface{}) (string, error)
- func GetVirtualChannel(pchannel string, collectionID int64, idx int) string
- func HandleTenantForEtcdKey(prefix string, tenant string, key string) string
- func IsEmptyString(str string) bool
- func IsGrant(operateType milvuspb.OperatePrivilegeType) bool
- func IsGrpcErr(err error, targets ...codes.Code) bool
- func IsPhysicalChannel(channel string) bool
- func IsRevoke(operateType milvuspb.OperatePrivilegeType) bool
- func JSONToMap(mStr string) (map[string]string, error)
- func JSONToRoleDetails(mStr string) (map[string](map[string]([](map[string]string))), error)
- func KeyValuePair2Map(datas []*commonpb.KeyValuePair) map[string]string
- func Map2KeyValuePair(datas map[string]string) []*commonpb.KeyValuePair
- func MapReduce(results []map[string]string, method map[string]func(string) error) error
- func MapToJSON(m map[string]string) []byte
- func Max[T constraints.Ordered](first T, values ...T) T
- func Min[T constraints.Ordered](first T, values ...T) T
- func PolicyForPrivilege(roleName string, objectType string, objectName string, privilege string, ...) string
- func PolicyForResource(dbName string, objectType string, objectName string) string
- func ProcessFuncParallel(total, maxParallel int, f ProcessFunc, fname string) error
- func ProcessTaskParallel(maxParallel int, fname string, tasks ...TaskFunc) error
- func RandomBytes(n int) []byte
- func RandomString(n int) string
- func ReadBinary(endian binary.ByteOrder, bs []byte, receiver interface{}) error
- func RoleDetailsToJSON(m map[string](map[string]([](map[string]string)))) []byte
- func SetContain(m1, m2 map[interface{}]struct{}) bool
- func SetToSlice(m map[interface{}]struct{}) []interface{}
- func SliceContain[T comparable](s []T, item T) bool
- func SliceSetEqual[T comparable](s1, s2 []T) bool
- func SortedSliceEqual(s1, s2 interface{}) bool
- func SplitObjectName(objectName string) (string, string)
- func ToPhysicalChannel(vchannel string) string
- type DataProcessFunc
- type ProcessFunc
- type TaskFunc
Constants ¶
const (
// PulsarMaxMessageSizeKey is the key of config item
PulsarMaxMessageSizeKey = "maxMessageSize"
)
Variables ¶
This section is empty.
Functions ¶
func CheckCtxValid ¶
CheckCtxValid check if the context is valid
func CheckGrpcReady ¶
CheckGrpcReady wait for context timeout, or wait 100ms then send nil to targetCh
func CheckPortAvailable ¶
CheckPortAvailable check if a port is available to be listened on
func CombineObjectName ¶
func ConvertChannelName ¶
ConvertChannelName assembles channel name according to parameters.
func ConvertToKeyValuePairPointer ¶
func ConvertToKeyValuePairPointer(datas []commonpb.KeyValuePair) []*commonpb.KeyValuePair
func EncodeUserRoleCache ¶
func GenChannelSubName ¶
GenChannelSubName generate subName to watch channel
func GetAttrByKeyFromRepeatedKV ¶
func GetAttrByKeyFromRepeatedKV(key string, kvs []*commonpb.KeyValuePair) (string, error)
GetAttrByKeyFromRepeatedKV return the value corresponding to key in kv pair
func GetAvailablePort ¶
func GetAvailablePort() int
GetAvailablePort return an available port that can be listened on
func GetFunctionName ¶
func GetFunctionName(i interface{}) string
GetFunctionName returns the name of input
func GetNumRowOfFieldData ¶
GetNumRowOfFieldData returns num of rows from the field data type
func GetNumRowOfFieldDataWithSchema ¶
func GetNumRowOfFieldDataWithSchema(fieldData *schemapb.FieldData, helper *typeutil.SchemaHelper) (uint64, error)
GetNumRowOfFieldDataWithSchema returns num of rows with schema specification.
func GetObjectName ¶
GetObjectName get object name from the grpc message according to the field index. The field is a string.
func GetObjectNames ¶
GetObjectNames get object names from the grpc message according to the field index. The field is an array.
func GetPrivilegeExtObj ¶
func GetPrivilegeExtObj(m interface{}) (commonpb.PrivilegeExt, error)
func GetValidLocalIP ¶
GetValidLocalIP return the first valid local ip address
func GetVecFieldIDs ¶
func GetVecFieldIDs(schema *schemapb.CollectionSchema) []int64
func GetVersion ¶
func GetVirtualChannel ¶
func HandleTenantForEtcdKey ¶
func IsEmptyString ¶
func IsGrant ¶
func IsGrant(operateType milvuspb.OperatePrivilegeType) bool
func IsPhysicalChannel ¶
IsPhysicalChannel checks if the channel is a physical channel
func IsRevoke ¶
func IsRevoke(operateType milvuspb.OperatePrivilegeType) bool
func JSONToRoleDetails ¶
func KeyValuePair2Map ¶
func KeyValuePair2Map(datas []*commonpb.KeyValuePair) map[string]string
func Map2KeyValuePair ¶
func Map2KeyValuePair(datas map[string]string) []*commonpb.KeyValuePair
func Max ¶
func Max[T constraints.Ordered](first T, values ...T) T
func Min ¶
func Min[T constraints.Ordered](first T, values ...T) T
func PolicyForPrivilege ¶
func PolicyForResource ¶
func ProcessFuncParallel ¶
func ProcessFuncParallel(total, maxParallel int, f ProcessFunc, fname string) error
ProcessFuncParallel processes function in parallel.
ProcessFuncParallel waits for all goroutines done if no errors occur. If some goroutines return error, ProcessFuncParallel cancels other goroutines as soon as possible and wait for all other goroutines done, and returns the first error occurs. Reference: https://stackoverflow.com/questions/40809504/idiomatic-goroutine-termination-and-error-handling
func ProcessTaskParallel ¶
ProcessTaskParallel processes tasks in parallel. Similar to ProcessFuncParallel
func ReadBinary ¶
ReadBinary read byte slice as receiver.
func RoleDetailsToJSON ¶
func SetContain ¶
func SetContain(m1, m2 map[interface{}]struct{}) bool
SetContain returns true if set m1 contains set m2
func SetToSlice ¶
func SetToSlice(m map[interface{}]struct{}) []interface{}
SetToSlice transform the set to a slice.
func SliceContain ¶
func SliceContain[T comparable](s []T, item T) bool
SliceContain returns true if slice s contains item.
func SliceSetEqual ¶
func SliceSetEqual[T comparable](s1, s2 []T) bool
SliceSetEqual is used to compare two Slice
func SortedSliceEqual ¶
func SortedSliceEqual(s1, s2 interface{}) bool
SortedSliceEqual is used to compare two Sorted Slice
func SplitObjectName ¶
func ToPhysicalChannel ¶
ToPhysicalChannel get physical channel name from virtual channel name
Types ¶
type DataProcessFunc ¶
type DataProcessFunc func(data interface{}) error