moduletools

package
v1.32.13 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: BSD-3-Clause Imports: 6 Imported by: 3

Documentation

Overview

moduletools contains helpers that are passed to modules as part of their capability methods

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeWeights added in v1.25.0

func NormalizeWeights(weights []float32) []float32

func SortStringKeys added in v1.25.0

func SortStringKeys(schemaMap map[string]interface{}) []string

Types

type ClassConfig

type ClassConfig interface {
	TargetVector() string
	Tenant() string
	Class() map[string]interface{}
	ClassByModuleName(moduleName string) map[string]interface{}
	Property(propName string) map[string]interface{}
	PropertiesDataTypes() map[string]schema.DataType
	Config() *config.Config
}

ClassConfig is a helper type which is passed to the module to read it's per-class config. This is - among other places - used when vectorizing and when validation schema config

type InitParams

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

func (*InitParams) GetAppState

func (p *InitParams) GetAppState() interface{}

func (*InitParams) GetConfig added in v1.21.4

func (p *InitParams) GetConfig() *config.Config

func (*InitParams) GetLogger

func (p *InitParams) GetLogger() logrus.FieldLogger

func (*InitParams) GetMetricsRegisterer added in v1.32.0

func (p *InitParams) GetMetricsRegisterer() prometheus.Registerer

func (*InitParams) GetStorageProvider

func (p *InitParams) GetStorageProvider() StorageProvider

type MockModuleInitParams added in v1.32.0

type MockModuleInitParams struct {
	mock.Mock
}

MockModuleInitParams is an autogenerated mock type for the ModuleInitParams type

func NewMockModuleInitParams added in v1.32.0

func NewMockModuleInitParams(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockModuleInitParams

NewMockModuleInitParams creates a new instance of MockModuleInitParams. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockModuleInitParams) EXPECT added in v1.32.0

func (*MockModuleInitParams) GetAppState added in v1.32.0

func (_m *MockModuleInitParams) GetAppState() interface{}

GetAppState provides a mock function with no fields

func (*MockModuleInitParams) GetConfig added in v1.32.0

func (_m *MockModuleInitParams) GetConfig() *config.Config

GetConfig provides a mock function with no fields

func (*MockModuleInitParams) GetLogger added in v1.32.0

func (_m *MockModuleInitParams) GetLogger() logrus.FieldLogger

GetLogger provides a mock function with no fields

func (*MockModuleInitParams) GetMetricsRegisterer added in v1.32.0

func (_m *MockModuleInitParams) GetMetricsRegisterer() prometheus.Registerer

GetMetricsRegisterer provides a mock function with no fields

func (*MockModuleInitParams) GetStorageProvider added in v1.32.0

func (_m *MockModuleInitParams) GetStorageProvider() StorageProvider

GetStorageProvider provides a mock function with no fields

type MockModuleInitParams_Expecter added in v1.32.0

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

func (*MockModuleInitParams_Expecter) GetAppState added in v1.32.0

GetAppState is a helper method to define mock.On call

func (*MockModuleInitParams_Expecter) GetConfig added in v1.32.0

GetConfig is a helper method to define mock.On call

func (*MockModuleInitParams_Expecter) GetLogger added in v1.32.0

GetLogger is a helper method to define mock.On call

func (*MockModuleInitParams_Expecter) GetMetricsRegisterer added in v1.32.0

GetMetricsRegisterer is a helper method to define mock.On call

func (*MockModuleInitParams_Expecter) GetStorageProvider added in v1.32.0

GetStorageProvider is a helper method to define mock.On call

type MockModuleInitParams_GetAppState_Call added in v1.32.0

type MockModuleInitParams_GetAppState_Call struct {
	*mock.Call
}

MockModuleInitParams_GetAppState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAppState'

func (*MockModuleInitParams_GetAppState_Call) Return added in v1.32.0

func (*MockModuleInitParams_GetAppState_Call) Run added in v1.32.0

func (*MockModuleInitParams_GetAppState_Call) RunAndReturn added in v1.32.0

func (_c *MockModuleInitParams_GetAppState_Call) RunAndReturn(run func() interface{}) *MockModuleInitParams_GetAppState_Call

type MockModuleInitParams_GetConfig_Call added in v1.32.0

type MockModuleInitParams_GetConfig_Call struct {
	*mock.Call
}

MockModuleInitParams_GetConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConfig'

func (*MockModuleInitParams_GetConfig_Call) Return added in v1.32.0

func (*MockModuleInitParams_GetConfig_Call) Run added in v1.32.0

func (*MockModuleInitParams_GetConfig_Call) RunAndReturn added in v1.32.0

type MockModuleInitParams_GetLogger_Call added in v1.32.0

type MockModuleInitParams_GetLogger_Call struct {
	*mock.Call
}

MockModuleInitParams_GetLogger_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLogger'

func (*MockModuleInitParams_GetLogger_Call) Return added in v1.32.0

func (*MockModuleInitParams_GetLogger_Call) Run added in v1.32.0

func (*MockModuleInitParams_GetLogger_Call) RunAndReturn added in v1.32.0

type MockModuleInitParams_GetMetricsRegisterer_Call added in v1.32.0

type MockModuleInitParams_GetMetricsRegisterer_Call struct {
	*mock.Call
}

MockModuleInitParams_GetMetricsRegisterer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMetricsRegisterer'

func (*MockModuleInitParams_GetMetricsRegisterer_Call) Return added in v1.32.0

func (*MockModuleInitParams_GetMetricsRegisterer_Call) Run added in v1.32.0

func (*MockModuleInitParams_GetMetricsRegisterer_Call) RunAndReturn added in v1.32.0

type MockModuleInitParams_GetStorageProvider_Call added in v1.32.0

type MockModuleInitParams_GetStorageProvider_Call struct {
	*mock.Call
}

MockModuleInitParams_GetStorageProvider_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStorageProvider'

func (*MockModuleInitParams_GetStorageProvider_Call) Return added in v1.32.0

func (*MockModuleInitParams_GetStorageProvider_Call) Run added in v1.32.0

func (*MockModuleInitParams_GetStorageProvider_Call) RunAndReturn added in v1.32.0

type ModuleInitParams

type ModuleInitParams interface {
	GetStorageProvider() StorageProvider
	GetAppState() interface{}
	GetLogger() logrus.FieldLogger
	GetConfig() *config.Config
	GetMetricsRegisterer() prometheus.Registerer
}

func NewInitParams

func NewInitParams(storageProvider StorageProvider, appState interface{},
	config *config.Config, logger logrus.FieldLogger, registerer prometheus.Registerer,
) ModuleInitParams

type ScanFn

type ScanFn func(k, v []byte) (bool, error)

type Storage

type Storage interface {
	Get(key []byte) ([]byte, error)
	Scan(scan ScanFn) error
	Put(key, value []byte) error
}

type StorageProvider

type StorageProvider interface {
	Storage(name string) (Storage, error)
	DataPath() string
}

Jump to

Keyboard shortcuts

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