service

package
v1.7.15 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Package service manages the main logic of server.

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 NGT

type NGT interface {
	Start(ctx context.Context) <-chan error
	Search(ctx context.Context, vec []float32, size uint32, epsilon, radius float32) (*payload.Search_Response, error)
	SearchByID(ctx context.Context, uuid string, size uint32, epsilon, radius float32) ([]float32, *payload.Search_Response, error)
	LinearSearch(ctx context.Context, vec []float32, size uint32) (*payload.Search_Response, error)
	LinearSearchByID(ctx context.Context, uuid string, size uint32) ([]float32, *payload.Search_Response, error)
	Insert(uuid string, vec []float32) (err error)
	InsertWithTime(uuid string, vec []float32, t int64) (err error)
	InsertMultiple(vecs map[string][]float32) (err error)
	InsertMultipleWithTime(vecs map[string][]float32, t int64) (err error)
	Update(uuid string, vec []float32) (err error)
	UpdateWithTime(uuid string, vec []float32, t int64) (err error)
	UpdateMultiple(vecs map[string][]float32) (err error)
	UpdateMultipleWithTime(vecs map[string][]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)
	DeleteMultiple(uuids ...string) (err error)
	DeleteMultipleWithTime(uuids []string, t int64) (err error)
	RegenerateIndexes(ctx context.Context) (err error)
	GetObject(uuid string) (vec []float32, timestamp int64, err error)
	ListObjectFunc(ctx context.Context, f func(uuid string, oid uint32, timestamp int64) bool)
	Exists(uuid string) (uint32, bool)
	CreateIndex(ctx context.Context, poolSize uint32) (err error)
	SaveIndex(ctx context.Context) (err error)
	CreateAndSaveIndex(ctx context.Context, poolSize uint32) (err error)
	IsIndexing() bool
	IsFlushing() bool
	IsSaving() bool
	Len() uint64
	NumberOfCreateIndexExecution() uint64
	NumberOfProactiveGCExecution() uint64
	UUIDs(context.Context) (uuids []string)
	InsertVQueueBufferLen() uint64
	DeleteVQueueBufferLen() uint64
	GetDimensionSize() int
	BrokenIndexCount() uint64
	IndexStatistics() (*payload.Info_Index_Statistics, error)
	IsStatisticsEnabled() bool
	IndexProperty() (*payload.Info_Index_Property, error)
	Close(ctx context.Context) error
}

func New

func New(cfg *config.NGT, opts ...Option) (nn NGT, err error)

type Option added in v0.0.47

type Option func(n *ngt) error

Option represent the functional option for ngt.

func WithAutoIndexCheckDuration added in v0.0.47

func WithAutoIndexCheckDuration(dur string) Option

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

func WithAutoIndexDurationLimit added in v0.0.47

func WithAutoIndexDurationLimit(dur string) Option

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

func WithAutoIndexLength added in v0.0.47

func WithAutoIndexLength(l int) Option

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

func WithAutoSaveIndexDuration added in v0.0.47

func WithAutoSaveIndexDuration(dur string) Option

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

func WithCopyOnWrite added in v1.5.0

func WithCopyOnWrite(enabled bool) Option

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

func WithDefaultEpsilon added in v0.0.47

func WithDefaultEpsilon(epsilon float32) Option

WithDefaultEpsilon returns the functional option to set the default epsilon for NGT.

func WithDefaultPoolSize added in v0.0.47

func WithDefaultPoolSize(ps uint32) Option

WithDefaultPoolSize returns the functional option to set the default pool size for NGT.

func WithDefaultRadius added in v0.0.47

func WithDefaultRadius(rad float32) Option

WithDefaultRadius returns the functional option to set the default radius for NGT.

func WithEnableInMemoryMode added in v0.0.47

func WithEnableInMemoryMode(enabled bool) Option

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

func WithEnableStatistics added in v1.7.13

func WithEnableStatistics(enabled bool) Option

WithEnableStatistics returns the functional option to set the statistics flag.

func WithErrGroup added in v0.0.47

func WithErrGroup(eg errgroup.Group) Option

WithErrGroup returns the functional option to set the error group.

func WithExportIndexInfoDuration added in v1.7.12

func WithExportIndexInfoDuration(dur string) Option

WithExportIndexInfoDuration returns the functional option to set the duration of exporting index info to k8s.

func WithIndexPath added in v0.0.47

func WithIndexPath(path string) Option

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

func WithInitialDelayMaxDuration added in v0.0.47

func WithInitialDelayMaxDuration(dur string) Option

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

func WithIsReadReplica added in v1.7.11

func WithIsReadReplica(isReadReplica bool) Option

WithIsReadReplica returns the functional option to set the read replica flag.

func WithLoadIndexTimeoutFactor added in v0.0.47

func WithLoadIndexTimeoutFactor(dur string) Option

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

func WithMaxLoadIndexTimeout added in v0.0.47

func WithMaxLoadIndexTimeout(dur string) Option

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

func WithMinLoadIndexTimeout added in v0.0.47

func WithMinLoadIndexTimeout(dur string) Option

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

func WithPatcher added in v1.7.13

func WithPatcher(p client.Patcher) Option

WithPatcher returns the functional option to set the patcher for patching k8s resources.

func WithProactiveGC added in v0.0.56

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