common

package
v1.23.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultSearchByDistInitialLimit :
	// the initial limit of 100 here is an
	// arbitrary decision, and can be tuned
	// as needed
	DefaultSearchByDistInitialLimit = 100

	// DefaultSearchByDistLimitMultiplier :
	// the decision to increase the limit in
	// multiples of 10 here is an arbitrary
	// decision, and can be tuned as needed
	DefaultSearchByDistLimitMultiplier = 10
)
View Source
const DefaultShardedLocksCount = 512

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiVectorForID

type MultiVectorForID func(ctx context.Context, ids []uint64) ([][]float32, []error)

type PqMaxPool

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

func NewPqMaxPool

func NewPqMaxPool(defaultCap int) *PqMaxPool

func (*PqMaxPool) GetMax

func (pqh *PqMaxPool) GetMax(capacity int) *priorityqueue.Queue[any]

func (*PqMaxPool) Put

func (pqh *PqMaxPool) Put(pq *priorityqueue.Queue[any])

type SearchByDistParams

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

func NewSearchByDistParams

func NewSearchByDistParams(
	offset int,
	limit int,
	totalLimit int,
	maximumSearchLimit int64,
) *SearchByDistParams

func (*SearchByDistParams) Iterate

func (params *SearchByDistParams) Iterate()

func (*SearchByDistParams) MaxLimitReached

func (params *SearchByDistParams) MaxLimitReached() bool

func (*SearchByDistParams) MaximumSearchLimit

func (params *SearchByDistParams) MaximumSearchLimit() int64

func (*SearchByDistParams) OffsetCapacity

func (params *SearchByDistParams) OffsetCapacity(ids []uint64) int

func (*SearchByDistParams) TotalLimit

func (params *SearchByDistParams) TotalLimit() int

func (*SearchByDistParams) TotalLimitCapacity

func (params *SearchByDistParams) TotalLimitCapacity(ids []uint64) int

type ShardedLocks

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

func NewDefaultShardedLocks

func NewDefaultShardedLocks() *ShardedLocks

func NewShardedLocks

func NewShardedLocks(count int) *ShardedLocks

func (*ShardedLocks) Lock

func (sl *ShardedLocks) Lock(id uint64)

func (*ShardedLocks) LockAll

func (sl *ShardedLocks) LockAll()

func (*ShardedLocks) Locked

func (sl *ShardedLocks) Locked(id uint64, callback func())

func (*ShardedLocks) LockedAll

func (sl *ShardedLocks) LockedAll(callback func())

func (*ShardedLocks) RLock

func (sl *ShardedLocks) RLock(id uint64)

func (*ShardedLocks) RLockAll

func (sl *ShardedLocks) RLockAll()

func (*ShardedLocks) RLocked

func (sl *ShardedLocks) RLocked(id uint64, callback func())

func (*ShardedLocks) RLockedAll

func (sl *ShardedLocks) RLockedAll(callback func())

func (*ShardedLocks) RUnlock

func (sl *ShardedLocks) RUnlock(id uint64)

func (*ShardedLocks) RUnlockAll

func (sl *ShardedLocks) RUnlockAll()

func (*ShardedLocks) Unlock

func (sl *ShardedLocks) Unlock(id uint64)

func (*ShardedLocks) UnlockAll

func (sl *ShardedLocks) UnlockAll()

type TempVectorForID

type TempVectorForID func(ctx context.Context, id uint64, container *VectorSlice) ([]float32, error)

type TempVectorsPool

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

func NewTempVectorsPool

func NewTempVectorsPool() *TempVectorsPool

func (*TempVectorsPool) Get

func (pool *TempVectorsPool) Get(capacity int) *VectorSlice

func (*TempVectorsPool) Put

func (pool *TempVectorsPool) Put(container *VectorSlice)

type VectorForID

type VectorForID[T float32 | byte | uint64] func(ctx context.Context, id uint64) ([]T, error)

type VectorSlice

type VectorSlice struct {
	Slice []float32
	Mem   []float32
	Buff8 []byte
	Buff  []byte
}

Jump to

Keyboard shortcuts

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