service

package
v1.7.17 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package service manages the main logic of server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Faiss

type Faiss interface {
	Start(ctx context.Context) <-chan error
	Search(k, nprobe, nq uint32, xq []float32) (*payload.Search_Response, error)
	Insert(uuid string, vec []float32) (err error)
	InsertWithTime(uuid string, vec []float32, t int64) (err error)
	Update(uuid string, vec []float32) (err error)
	UpdateWithTime(uuid string, vec []float32, t int64) (err error)
	UpdateTimestamp(uuid string, ts int64, force bool) (err error)
	Delete(uuid string) (err error)
	DeleteWithTime(uuid string, t int64) (err error)
	Exists(uuid string) (uint32, bool)
	CreateIndex(ctx context.Context) (err error)
	SaveIndex(ctx context.Context) (err error)
	CreateAndSaveIndex(ctx context.Context) (err error)
	Train(nb int, vec []float32) (err error)
	IsIndexing() bool
	IsSaving() bool
	Len() uint64
	NumberOfCreateIndexExecution() uint64
	NumberOfProactiveGCExecution() uint64
	UUIDs(context.Context) (uuids []string)
	InsertVQueueBufferLen() uint64
	DeleteVQueueBufferLen() uint64
	GetDimensionSize() int
	GetTrainSize() int
	Close(ctx context.Context) error
}

func New

func New(cfg *config.Faiss, opts ...Option) (Faiss, error)

type Option

type Option func(f *faiss) error

Option represent the functional option for faiss.

func WithAutoIndexCheckDuration

func WithAutoIndexCheckDuration(dur string) Option

WithAutoIndexCheckDuration returns the functional option to set the index check duration.

func WithAutoIndexDurationLimit

func WithAutoIndexDurationLimit(dur string) Option

WithAutoIndexDurationLimit returns the functional option to set the auto index duration limit.

func WithAutoIndexLength

func WithAutoIndexLength(l int) Option

WithAutoIndexLength returns the functional option to set the auto index length.

func WithAutoSaveIndexDuration

func WithAutoSaveIndexDuration(dur string) Option

WithAutoSaveIndexDuration returns the functional option to set the auto save index duration.

func WithCopyOnWrite

func WithCopyOnWrite(enabled bool) Option

WithCopyOnWrite returns the functional option to set the CoW enable flag.

func WithEnableInMemoryMode

func WithEnableInMemoryMode(enabled bool) Option

WithEnableInMemoryMode returns the functional option to set the in memory mode flag.

func WithErrGroup

func WithErrGroup(eg errgroup.Group) Option

WithErrGroup returns the functional option to set the error group.

func WithIndexPath

func WithIndexPath(path string) Option

WithIndexPath returns the functional option to set the index path of the Faiss.

func WithInitialDelayMaxDuration

func WithInitialDelayMaxDuration(dur string) Option

WithInitialDelayMaxDuration returns the functional option to set the initial delay duration.

func WithLoadIndexTimeoutFactor

func WithLoadIndexTimeoutFactor(dur string) Option

WithLoadIndexTimeoutFactor returns the functional option to set the factor of load index timeout.

func WithMaxLoadIndexTimeout

func WithMaxLoadIndexTimeout(dur string) Option

WithMaxLoadIndexTimeout returns the functional option to set the maximum load index timeout.

func WithMinLoadIndexTimeout

func WithMinLoadIndexTimeout(dur string) Option

WithMinLoadIndexTimeout returns the functional option to set the minimal load index timeout.

func WithProactiveGC

func WithProactiveGC(enabled bool) Option

WithProactiveGC returns the functional option to set the proactive GC enable flag.

Jump to

Keyboard shortcuts

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