Documentation
¶
Overview ¶
Package migrate provides a simple composer tool, which implements the Migrator interface and can take in any number of migrators which themselves have to implement the interface
Index ¶
- Constants
- Variables
- func Diff(leftLabel string, left *State, rightLabel string, right *State) []string
- func NewExecutor(migrator Migrator, sr SchemaReader, logger logrus.FieldLogger, ...) *executor
- func UpdateClassInternal(h *Handler, ctx context.Context, className string, updated *models.Class) error
- type ClassGetter
- type ClassPayload
- type CreateTenantPayload
- type Handler
- func (h *Handler) AddAlias(ctx context.Context, principal *models.Principal, alias *models.Alias) (*models.Alias, uint64, error)
- func (h *Handler) AddClass(ctx context.Context, principal *models.Principal, cls *models.Class) (*models.Class, uint64, error)
- func (h *Handler) AddClassProperty(ctx context.Context, principal *models.Principal, class *models.Class, ...) (*models.Class, uint64, error)
- func (h *Handler) AddTenants(ctx context.Context, principal *models.Principal, class string, ...) (uint64, error)
- func (h *Handler) ConsistentTenantExists(ctx context.Context, principal *models.Principal, class string, ...) error
- func (h *Handler) DeleteAlias(ctx context.Context, principal *models.Principal, aliasName string) error
- func (h *Handler) DeleteClass(ctx context.Context, principal *models.Principal, class string) error
- func (h *Handler) DeleteClassProperty(ctx context.Context, principal *models.Principal, class string, ...) error
- func (h *Handler) DeleteTenants(ctx context.Context, principal *models.Principal, class string, ...) error
- func (h *Handler) GetAlias(ctx context.Context, principal *models.Principal, alias string) ([]*models.Alias, error)
- func (h *Handler) GetAliases(ctx context.Context, principal *models.Principal, alias, className string) ([]*models.Alias, error)
- func (h *Handler) GetCachedClass(ctxWithClassCache context.Context, principal *models.Principal, ...) (map[string]versioned.Class, error)
- func (h *Handler) GetCachedClassNoAuth(ctxWithClassCache context.Context, names ...string) (map[string]versioned.Class, error)
- func (h *Handler) GetClass(ctx context.Context, principal *models.Principal, name string) (*models.Class, error)
- func (h *Handler) GetConsistentClass(ctx context.Context, principal *models.Principal, name string, ...) (*models.Class, uint64, error)
- func (h *Handler) GetConsistentSchema(ctx context.Context, principal *models.Principal, consistency bool) (schema.Schema, error)
- func (h *Handler) GetConsistentTenant(ctx context.Context, principal *models.Principal, class string, ...) (*models.Tenant, error)
- func (h *Handler) GetConsistentTenants(ctx context.Context, principal *models.Principal, class string, ...) ([]*models.Tenant, error)
- func (h *Handler) GetSchemaSkipAuth() schema.Schema
- func (h *Handler) JoinNode(ctx context.Context, node string, nodePort string, voter bool) error
- func (h *Handler) NodeName() string
- func (h *Handler) Nodes() []string
- func (h *Handler) RemoveNode(ctx context.Context, node string) error
- func (h *Handler) RestoreClass(ctx context.Context, d *backup.ClassDescriptor, m map[string]string) error
- func (h *Handler) ShardsStatus(ctx context.Context, principal *models.Principal, class, shard string) (models.ShardStatusList, error)
- func (h *Handler) Statistics() map[string]any
- func (h *Handler) StoreSchemaV1() error
- func (h *Handler) UpdateAlias(ctx context.Context, principal *models.Principal, ...) (*models.Alias, error)
- func (h *Handler) UpdateClass(ctx context.Context, principal *models.Principal, className string, ...) error
- func (h *Handler) UpdateShardStatus(ctx context.Context, principal *models.Principal, class, shard, status string) (uint64, error)
- func (h *Handler) UpdateTenants(ctx context.Context, principal *models.Principal, class string, ...) ([]*models.Tenant, error)
- type InvertedConfigValidator
- type KeyValuePair
- type Manager
- func (m *Manager) AllowImplicitTenantActivation(class string) bool
- func (m *Manager) ClusterHealthScore() int
- func (m *Manager) OptimisticTenantStatus(ctx context.Context, class string, tenant string) (map[string]string, error)
- func (m *Manager) ResolveParentNodes(class, shardName string) (map[string]string, error)
- func (m *Manager) ShardOwner(class, shard string) (string, error)
- func (m *Manager) TenantsShards(ctx context.Context, class string, tenants ...string) (map[string]string, error)
- type Migrator
- type MockSchemaGetter
- func (_m *MockSchemaGetter) ClusterHealthScore() int
- func (_m *MockSchemaGetter) CopyShardingState(class string) *sharding.State
- func (_m *MockSchemaGetter) EXPECT() *MockSchemaGetter_Expecter
- func (_m *MockSchemaGetter) GetSchemaSkipAuth() entitiesschema.Schema
- func (_m *MockSchemaGetter) NodeName() string
- func (_m *MockSchemaGetter) Nodes() []string
- func (_m *MockSchemaGetter) OptimisticTenantStatus(ctx context.Context, class string, tenants string) (map[string]string, error)
- func (_m *MockSchemaGetter) ReadOnlyClass(_a0 string) *models.Class
- func (_m *MockSchemaGetter) ResolveAlias(_a0 string) string
- func (_m *MockSchemaGetter) ResolveParentNodes(_a0 string, _a1 string) (map[string]string, error)
- func (_m *MockSchemaGetter) ShardFromUUID(class string, uuid []byte) string
- func (_m *MockSchemaGetter) ShardOwner(class string, shard string) (string, error)
- func (_m *MockSchemaGetter) ShardReplicas(class string, shard string) ([]string, error)
- func (_m *MockSchemaGetter) Statistics() map[string]interface{}
- func (_m *MockSchemaGetter) TenantsShards(ctx context.Context, class string, tenants ...string) (map[string]string, error)
- type MockSchemaGetter_ClusterHealthScore_Call
- func (_c *MockSchemaGetter_ClusterHealthScore_Call) Return(_a0 int) *MockSchemaGetter_ClusterHealthScore_Call
- func (_c *MockSchemaGetter_ClusterHealthScore_Call) Run(run func()) *MockSchemaGetter_ClusterHealthScore_Call
- func (_c *MockSchemaGetter_ClusterHealthScore_Call) RunAndReturn(run func() int) *MockSchemaGetter_ClusterHealthScore_Call
- type MockSchemaGetter_CopyShardingState_Call
- func (_c *MockSchemaGetter_CopyShardingState_Call) Return(_a0 *sharding.State) *MockSchemaGetter_CopyShardingState_Call
- func (_c *MockSchemaGetter_CopyShardingState_Call) Run(run func(class string)) *MockSchemaGetter_CopyShardingState_Call
- func (_c *MockSchemaGetter_CopyShardingState_Call) RunAndReturn(run func(string) *sharding.State) *MockSchemaGetter_CopyShardingState_Call
- type MockSchemaGetter_Expecter
- func (_e *MockSchemaGetter_Expecter) ClusterHealthScore() *MockSchemaGetter_ClusterHealthScore_Call
- func (_e *MockSchemaGetter_Expecter) CopyShardingState(class interface{}) *MockSchemaGetter_CopyShardingState_Call
- func (_e *MockSchemaGetter_Expecter) GetSchemaSkipAuth() *MockSchemaGetter_GetSchemaSkipAuth_Call
- func (_e *MockSchemaGetter_Expecter) NodeName() *MockSchemaGetter_NodeName_Call
- func (_e *MockSchemaGetter_Expecter) Nodes() *MockSchemaGetter_Nodes_Call
- func (_e *MockSchemaGetter_Expecter) OptimisticTenantStatus(ctx interface{}, class interface{}, tenants interface{}) *MockSchemaGetter_OptimisticTenantStatus_Call
- func (_e *MockSchemaGetter_Expecter) ReadOnlyClass(_a0 interface{}) *MockSchemaGetter_ReadOnlyClass_Call
- func (_e *MockSchemaGetter_Expecter) ResolveAlias(_a0 interface{}) *MockSchemaGetter_ResolveAlias_Call
- func (_e *MockSchemaGetter_Expecter) ResolveParentNodes(_a0 interface{}, _a1 interface{}) *MockSchemaGetter_ResolveParentNodes_Call
- func (_e *MockSchemaGetter_Expecter) ShardFromUUID(class interface{}, uuid interface{}) *MockSchemaGetter_ShardFromUUID_Call
- func (_e *MockSchemaGetter_Expecter) ShardOwner(class interface{}, shard interface{}) *MockSchemaGetter_ShardOwner_Call
- func (_e *MockSchemaGetter_Expecter) ShardReplicas(class interface{}, shard interface{}) *MockSchemaGetter_ShardReplicas_Call
- func (_e *MockSchemaGetter_Expecter) Statistics() *MockSchemaGetter_Statistics_Call
- func (_e *MockSchemaGetter_Expecter) TenantsShards(ctx interface{}, class interface{}, tenants ...interface{}) *MockSchemaGetter_TenantsShards_Call
- type MockSchemaGetter_GetSchemaSkipAuth_Call
- func (_c *MockSchemaGetter_GetSchemaSkipAuth_Call) Return(_a0 entitiesschema.Schema) *MockSchemaGetter_GetSchemaSkipAuth_Call
- func (_c *MockSchemaGetter_GetSchemaSkipAuth_Call) Run(run func()) *MockSchemaGetter_GetSchemaSkipAuth_Call
- func (_c *MockSchemaGetter_GetSchemaSkipAuth_Call) RunAndReturn(run func() entitiesschema.Schema) *MockSchemaGetter_GetSchemaSkipAuth_Call
- type MockSchemaGetter_NodeName_Call
- type MockSchemaGetter_Nodes_Call
- type MockSchemaGetter_OptimisticTenantStatus_Call
- func (_c *MockSchemaGetter_OptimisticTenantStatus_Call) Return(_a0 map[string]string, _a1 error) *MockSchemaGetter_OptimisticTenantStatus_Call
- func (_c *MockSchemaGetter_OptimisticTenantStatus_Call) Run(run func(ctx context.Context, class string, tenants string)) *MockSchemaGetter_OptimisticTenantStatus_Call
- func (_c *MockSchemaGetter_OptimisticTenantStatus_Call) RunAndReturn(run func(context.Context, string, string) (map[string]string, error)) *MockSchemaGetter_OptimisticTenantStatus_Call
- type MockSchemaGetter_ReadOnlyClass_Call
- func (_c *MockSchemaGetter_ReadOnlyClass_Call) Return(_a0 *models.Class) *MockSchemaGetter_ReadOnlyClass_Call
- func (_c *MockSchemaGetter_ReadOnlyClass_Call) Run(run func(_a0 string)) *MockSchemaGetter_ReadOnlyClass_Call
- func (_c *MockSchemaGetter_ReadOnlyClass_Call) RunAndReturn(run func(string) *models.Class) *MockSchemaGetter_ReadOnlyClass_Call
- type MockSchemaGetter_ResolveAlias_Call
- func (_c *MockSchemaGetter_ResolveAlias_Call) Return(_a0 string) *MockSchemaGetter_ResolveAlias_Call
- func (_c *MockSchemaGetter_ResolveAlias_Call) Run(run func(_a0 string)) *MockSchemaGetter_ResolveAlias_Call
- func (_c *MockSchemaGetter_ResolveAlias_Call) RunAndReturn(run func(string) string) *MockSchemaGetter_ResolveAlias_Call
- type MockSchemaGetter_ResolveParentNodes_Call
- func (_c *MockSchemaGetter_ResolveParentNodes_Call) Return(_a0 map[string]string, _a1 error) *MockSchemaGetter_ResolveParentNodes_Call
- func (_c *MockSchemaGetter_ResolveParentNodes_Call) Run(run func(_a0 string, _a1 string)) *MockSchemaGetter_ResolveParentNodes_Call
- func (_c *MockSchemaGetter_ResolveParentNodes_Call) RunAndReturn(run func(string, string) (map[string]string, error)) *MockSchemaGetter_ResolveParentNodes_Call
- type MockSchemaGetter_ShardFromUUID_Call
- func (_c *MockSchemaGetter_ShardFromUUID_Call) Return(_a0 string) *MockSchemaGetter_ShardFromUUID_Call
- func (_c *MockSchemaGetter_ShardFromUUID_Call) Run(run func(class string, uuid []byte)) *MockSchemaGetter_ShardFromUUID_Call
- func (_c *MockSchemaGetter_ShardFromUUID_Call) RunAndReturn(run func(string, []byte) string) *MockSchemaGetter_ShardFromUUID_Call
- type MockSchemaGetter_ShardOwner_Call
- func (_c *MockSchemaGetter_ShardOwner_Call) Return(_a0 string, _a1 error) *MockSchemaGetter_ShardOwner_Call
- func (_c *MockSchemaGetter_ShardOwner_Call) Run(run func(class string, shard string)) *MockSchemaGetter_ShardOwner_Call
- func (_c *MockSchemaGetter_ShardOwner_Call) RunAndReturn(run func(string, string) (string, error)) *MockSchemaGetter_ShardOwner_Call
- type MockSchemaGetter_ShardReplicas_Call
- func (_c *MockSchemaGetter_ShardReplicas_Call) Return(_a0 []string, _a1 error) *MockSchemaGetter_ShardReplicas_Call
- func (_c *MockSchemaGetter_ShardReplicas_Call) Run(run func(class string, shard string)) *MockSchemaGetter_ShardReplicas_Call
- func (_c *MockSchemaGetter_ShardReplicas_Call) RunAndReturn(run func(string, string) ([]string, error)) *MockSchemaGetter_ShardReplicas_Call
- type MockSchemaGetter_Statistics_Call
- func (_c *MockSchemaGetter_Statistics_Call) Return(_a0 map[string]interface{}) *MockSchemaGetter_Statistics_Call
- func (_c *MockSchemaGetter_Statistics_Call) Run(run func()) *MockSchemaGetter_Statistics_Call
- func (_c *MockSchemaGetter_Statistics_Call) RunAndReturn(run func() map[string]interface{}) *MockSchemaGetter_Statistics_Call
- type MockSchemaGetter_TenantsShards_Call
- func (_c *MockSchemaGetter_TenantsShards_Call) Return(_a0 map[string]string, _a1 error) *MockSchemaGetter_TenantsShards_Call
- func (_c *MockSchemaGetter_TenantsShards_Call) Run(run func(ctx context.Context, class string, tenants ...string)) *MockSchemaGetter_TenantsShards_Call
- func (_c *MockSchemaGetter_TenantsShards_Call) RunAndReturn(run func(context.Context, string, ...string) (map[string]string, error)) *MockSchemaGetter_TenantsShards_Call
- type ModuleConfig
- type Parser
- type RefFinder
- type SchemaGetter
- type SchemaManager
- type SchemaReader
- type SchemaStore
- type State
- type UpdateTenantPayload
- type VectorConfigParser
- type VectorizerValidator
Constants ¶
const (
ErrMsgMaxAllowedTenants = "" /* 136-byte string literal not displayed */
)
Variables ¶
var ( ErrNotFound = errors.New("not found") ErrUnexpectedMultiple = errors.New("unexpected multiple results") )
Functions ¶
func Diff ¶ added in v1.17.4
Diff creates human-readable information about the difference in two schemas, returns a len=0 slice if schemas are identical
func NewExecutor ¶ added in v1.25.0
func NewExecutor(migrator Migrator, sr SchemaReader, logger logrus.FieldLogger, classBackupDir func(string) error, ) *executor
NewManager creates a new manager
Types ¶
type ClassGetter ¶ added in v1.27.12
type ClassGetter struct {
// contains filtered or unexported fields
}
func NewClassGetter ¶ added in v1.27.11
func NewClassGetter( schemaParser *Parser, schemaManager SchemaManager, schemaReader SchemaReader, collectionRetrievalStrategyFF *configRuntime.FeatureFlag[string], logger logrus.FieldLogger, ) *ClassGetter
type ClassPayload ¶ added in v1.20.0
type ClassPayload struct {
Name string
Metadata []byte
ShardingState []byte
Shards []KeyValuePair
ReplaceShards bool
Error error
}
ClassPayload is used to serialize class updates
type CreateTenantPayload ¶ added in v1.25.0
type Handler ¶ added in v1.25.0
type Handler struct {
Authorizer authorization.Authorizer
// contains filtered or unexported fields
}
The handler manages API requests for manipulating class schemas. This separation of responsibilities helps decouple these tasks from the Manager class, which combines many unrelated functions. By delegating these clear responsibilities to the handler, it maintains a clean separation from the manager, enhancing code modularity and maintainability.
func NewHandler ¶ added in v1.25.0
func NewHandler( schemaReader SchemaReader, schemaManager SchemaManager, validator validator, logger logrus.FieldLogger, authorizer authorization.Authorizer, schemaConfig *config.SchemaHandlerConfig, config config.Config, configParser VectorConfigParser, vectorizerValidator VectorizerValidator, invertedConfigValidator InvertedConfigValidator, moduleConfig ModuleConfig, clusterState clusterState, scaleoutManager scaleOut, cloud modulecapabilities.OffloadCloud, parser Parser, classGetter *ClassGetter, ) (Handler, error)
NewHandler creates a new handler
func (*Handler) AddClass ¶ added in v1.25.0
func (h *Handler) AddClass(ctx context.Context, principal *models.Principal, cls *models.Class, ) (*models.Class, uint64, error)
AddClass to the schema
func (*Handler) AddClassProperty ¶ added in v1.25.0
func (h *Handler) AddClassProperty(ctx context.Context, principal *models.Principal, class *models.Class, className string, merge bool, newProps ...*models.Property, ) (*models.Class, uint64, error)
AddClassProperty it is upsert operation. it adds properties to a class and updates existing properties if the merge bool passed true.
func (*Handler) AddTenants ¶ added in v1.25.0
func (h *Handler) AddTenants(ctx context.Context, principal *models.Principal, class string, tenants []*models.Tenant, ) (uint64, error)
AddTenants is used to add new tenants to a class Class must exist and has partitioning enabled
func (*Handler) ConsistentTenantExists ¶ added in v1.25.0
func (h *Handler) ConsistentTenantExists(ctx context.Context, principal *models.Principal, class string, consistency bool, tenant string) error
TenantExists is used to check if the tenant exists of a class
Class must exist and has partitioning enabled
func (*Handler) DeleteAlias ¶ added in v1.32.0
func (*Handler) DeleteClass ¶ added in v1.25.0
DeleteClass from the schema
func (*Handler) DeleteClassProperty ¶ added in v1.25.0
func (h *Handler) DeleteClassProperty(ctx context.Context, principal *models.Principal, class string, property string, ) error
DeleteClassProperty from existing Schema
func (*Handler) DeleteTenants ¶ added in v1.25.0
func (h *Handler) DeleteTenants(ctx context.Context, principal *models.Principal, class string, tenants []string) error
DeleteTenants is used to delete tenants of a class.
Class must exist and has partitioning enabled
func (*Handler) GetAliases ¶ added in v1.32.0
func (*Handler) GetCachedClass ¶ added in v1.25.0
func (h *Handler) GetCachedClass(ctxWithClassCache context.Context, principal *models.Principal, names ...string, ) (map[string]versioned.Class, error)
GetCachedClass will return the class from the cache if it exists. Note that the context cache will likely be at the "request" or "operation" level and not be shared between requests. Uses the Handler's getClassMethod to determine how to get the class data.
func (*Handler) GetCachedClassNoAuth ¶ added in v1.28.5
func (h *Handler) GetCachedClassNoAuth(ctxWithClassCache context.Context, names ...string) (map[string]versioned.Class, error)
GetCachedClassNoAuth will return the class from the cache if it exists. Note that the context cache will likely be at the "request" or "operation" level and not be shared between requests. Uses the Handler's getClassMethod to determine how to get the class data.
func (*Handler) GetConsistentClass ¶ added in v1.25.0
func (*Handler) GetConsistentSchema ¶ added in v1.25.0
func (h *Handler) GetConsistentSchema(ctx context.Context, principal *models.Principal, consistency bool) (schema.Schema, error)
GetSchema retrieves a locally cached copy of the schema
func (*Handler) GetConsistentTenant ¶ added in v1.29.3
func (*Handler) GetConsistentTenants ¶ added in v1.25.0
func (*Handler) GetSchemaSkipAuth ¶ added in v1.25.0
GetSchemaSkipAuth can never be used as a response to a user request as it could leak the schema to an unauthorized user, is intended to be used for non-user triggered processes, such as regular updates / maintenance / etc
func (*Handler) JoinNode ¶ added in v1.25.0
JoinNode adds the given node to the cluster. Node needs to reachable via memberlist/gossip. If nodePort is an empty string, nodePort will be the default raft port. If the node is not reachable using memberlist, an error is returned If joining the node fails, an error is returned.
func (*Handler) RemoveNode ¶ added in v1.25.0
RemoveNode removes the given node from the cluster.
func (*Handler) RestoreClass ¶ added in v1.25.0
func (*Handler) ShardsStatus ¶ added in v1.25.0
func (*Handler) Statistics ¶ added in v1.25.0
Statistics is used to return a map of various internal stats. This should only be used for informative purposes or debugging.
func (*Handler) StoreSchemaV1 ¶ added in v1.25.0
func (*Handler) UpdateAlias ¶ added in v1.32.0
func (*Handler) UpdateClass ¶ added in v1.25.0
func (*Handler) UpdateShardStatus ¶ added in v1.25.0
func (*Handler) UpdateTenants ¶ added in v1.25.0
func (h *Handler) UpdateTenants(ctx context.Context, principal *models.Principal, class string, tenants []*models.Tenant, ) ([]*models.Tenant, error)
UpdateTenants is used to set activity status of tenants of a class.
Class must exist and has partitioning enabled
type InvertedConfigValidator ¶
type InvertedConfigValidator func(in *models.InvertedIndexConfig) error
type KeyValuePair ¶ added in v1.20.0
KeyValuePair is used to serialize shards updates
type Manager ¶
type Manager struct {
Authorizer authorization.Authorizer
sync.RWMutex
// The handler is responsible for well-defined tasks and should be decoupled from the manager.
// This enables API requests to be directed straight to the handler without the need to pass through the manager.
// For more context, refer to the handler's definition.
Handler
SchemaReader
// contains filtered or unexported fields
}
Manager Manages schema changes at a use-case level, i.e. agnostic of underlying databases or storage providers
func NewManager ¶
func NewManager(validator validator, schemaManager SchemaManager, schemaReader SchemaReader, repo SchemaStore, logger logrus.FieldLogger, authorizer authorization.Authorizer, schemaConfig *config.SchemaHandlerConfig, config config.Config, configParser VectorConfigParser, vectorizerValidator VectorizerValidator, invertedConfigValidator InvertedConfigValidator, moduleConfig ModuleConfig, clusterState clusterState, scaleoutManager scaleOut, cloud modulecapabilities.OffloadCloud, parser Parser, collectionRetrievalStrategyFF *configRuntime.FeatureFlag[string], ) (*Manager, error)
NewManager creates a new manager
func (*Manager) AllowImplicitTenantActivation ¶ added in v1.25.2
func (*Manager) ClusterHealthScore ¶
func (*Manager) OptimisticTenantStatus ¶ added in v1.25.0
func (m *Manager) OptimisticTenantStatus(ctx context.Context, class string, tenant string) (map[string]string, error)
OptimisticTenantStatus tries to query the local state first. It is optimistic that the state has already propagated correctly. If the state is unexpected, i.e. either the tenant is not found at all or the status is COLD, it will double-check with the leader.
This way we accept false positives (for HOT tenants), but guarantee that there will never be false negatives (i.e. tenants labelled as COLD that the leader thinks should be HOT).
This means:
- If a tenant is HOT locally (true positive), we proceed normally
- If a tenant is HOT locally, but should be COLD (false positive), we still proceed. This is a conscious decision to keep the happy path free from (expensive) leader lookups.
- If a tenant is not found locally, we assume it was recently created, but the state hasn't propagated yet. To verify, we check with the leader.
- If a tenant is found locally, but is marked as COLD, we assume it was recently turned HOT, but the state hasn't propagated yet. To verify, we check with the leader
Overall, we keep the (very common) happy path, free from expensive leader-lookups and only fall back to the leader if the local result implies an unhappy path.
func (*Manager) ResolveParentNodes ¶ added in v1.18.0
ResolveParentNodes gets all replicas for a specific class shard and resolves their names
it returns map[node_name] node_address where node_address = "" if can't resolve node_name
func (*Manager) ShardOwner ¶ added in v1.20.0
type Migrator ¶ added in v1.25.0
type Migrator interface {
AddClass(ctx context.Context, class *models.Class, shardingState *sharding.State) error
DropClass(ctx context.Context, className string, hasFrozen bool) error
// UpdateClass(ctx context.Context, className string,newClassName *string) error
GetShardsQueueSize(ctx context.Context, className, tenant string) (map[string]int64, error)
LoadShard(ctx context.Context, class, shard string) error
DropShard(ctx context.Context, class, shard string) error
ShutdownShard(ctx context.Context, class, shard string) error
AddProperty(ctx context.Context, className string,
props ...*models.Property) error
UpdateProperty(ctx context.Context, className string,
propName string, newName *string) error
UpdateIndex(ctx context.Context, class *models.Class, shardingState *sharding.State) error
NewTenants(ctx context.Context, class *models.Class, creates []*CreateTenantPayload) error
UpdateTenants(ctx context.Context, class *models.Class, updates []*UpdateTenantPayload, implicitUpdate bool) error
DeleteTenants(ctx context.Context, class string, tenants []*models.Tenant) error
GetShardsStatus(ctx context.Context, className, tenant string) (map[string]string, error)
UpdateShardStatus(ctx context.Context, className, shardName, targetStatus string, schemaVersion uint64) error
UpdateVectorIndexConfig(ctx context.Context, className string, updated schemaConfig.VectorIndexConfig) error
ValidateVectorIndexConfigsUpdate(old, updated map[string]schemaConfig.VectorIndexConfig) error
UpdateVectorIndexConfigs(ctx context.Context, className string,
updated map[string]schemaConfig.VectorIndexConfig) error
ValidateInvertedIndexConfigUpdate(old, updated *models.InvertedIndexConfig) error
UpdateInvertedIndexConfig(ctx context.Context, className string,
updated *models.InvertedIndexConfig) error
UpdateReplicationConfig(ctx context.Context, className string,
updated *models.ReplicationConfig) error
WaitForStartup(context.Context) error
Shutdown(context.Context) error
}
Migrator represents both the input and output interface of the Composer
type MockSchemaGetter ¶ added in v1.27.27
MockSchemaGetter is an autogenerated mock type for the SchemaGetter type
func NewMockSchemaGetter ¶ added in v1.27.27
func NewMockSchemaGetter(t interface {
mock.TestingT
Cleanup(func())
}) *MockSchemaGetter
NewMockSchemaGetter creates a new instance of MockSchemaGetter. 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 (*MockSchemaGetter) ClusterHealthScore ¶ added in v1.27.27
func (_m *MockSchemaGetter) ClusterHealthScore() int
ClusterHealthScore provides a mock function with no fields
func (*MockSchemaGetter) CopyShardingState ¶ added in v1.27.27
func (_m *MockSchemaGetter) CopyShardingState(class string) *sharding.State
CopyShardingState provides a mock function with given fields: class
func (*MockSchemaGetter) EXPECT ¶ added in v1.27.27
func (_m *MockSchemaGetter) EXPECT() *MockSchemaGetter_Expecter
func (*MockSchemaGetter) GetSchemaSkipAuth ¶ added in v1.27.27
func (_m *MockSchemaGetter) GetSchemaSkipAuth() entitiesschema.Schema
GetSchemaSkipAuth provides a mock function with no fields
func (*MockSchemaGetter) NodeName ¶ added in v1.27.27
func (_m *MockSchemaGetter) NodeName() string
NodeName provides a mock function with no fields
func (*MockSchemaGetter) Nodes ¶ added in v1.27.27
func (_m *MockSchemaGetter) Nodes() []string
Nodes provides a mock function with no fields
func (*MockSchemaGetter) OptimisticTenantStatus ¶ added in v1.27.27
func (_m *MockSchemaGetter) OptimisticTenantStatus(ctx context.Context, class string, tenants string) (map[string]string, error)
OptimisticTenantStatus provides a mock function with given fields: ctx, class, tenants
func (*MockSchemaGetter) ReadOnlyClass ¶ added in v1.27.27
func (_m *MockSchemaGetter) ReadOnlyClass(_a0 string) *models.Class
ReadOnlyClass provides a mock function with given fields: _a0
func (*MockSchemaGetter) ResolveAlias ¶ added in v1.32.0
func (_m *MockSchemaGetter) ResolveAlias(_a0 string) string
ResolveAlias provides a mock function with given fields: _a0
func (*MockSchemaGetter) ResolveParentNodes ¶ added in v1.27.27
ResolveParentNodes provides a mock function with given fields: _a0, _a1
func (*MockSchemaGetter) ShardFromUUID ¶ added in v1.27.27
func (_m *MockSchemaGetter) ShardFromUUID(class string, uuid []byte) string
ShardFromUUID provides a mock function with given fields: class, uuid
func (*MockSchemaGetter) ShardOwner ¶ added in v1.27.27
func (_m *MockSchemaGetter) ShardOwner(class string, shard string) (string, error)
ShardOwner provides a mock function with given fields: class, shard
func (*MockSchemaGetter) ShardReplicas ¶ added in v1.27.27
func (_m *MockSchemaGetter) ShardReplicas(class string, shard string) ([]string, error)
ShardReplicas provides a mock function with given fields: class, shard
func (*MockSchemaGetter) Statistics ¶ added in v1.27.27
func (_m *MockSchemaGetter) Statistics() map[string]interface{}
Statistics provides a mock function with no fields
func (*MockSchemaGetter) TenantsShards ¶ added in v1.27.27
func (_m *MockSchemaGetter) TenantsShards(ctx context.Context, class string, tenants ...string) (map[string]string, error)
TenantsShards provides a mock function with given fields: ctx, class, tenants
type MockSchemaGetter_ClusterHealthScore_Call ¶ added in v1.27.27
MockSchemaGetter_ClusterHealthScore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClusterHealthScore'
func (*MockSchemaGetter_ClusterHealthScore_Call) Return ¶ added in v1.27.27
func (_c *MockSchemaGetter_ClusterHealthScore_Call) Return(_a0 int) *MockSchemaGetter_ClusterHealthScore_Call
func (*MockSchemaGetter_ClusterHealthScore_Call) Run ¶ added in v1.27.27
func (_c *MockSchemaGetter_ClusterHealthScore_Call) Run(run func()) *MockSchemaGetter_ClusterHealthScore_Call
func (*MockSchemaGetter_ClusterHealthScore_Call) RunAndReturn ¶ added in v1.27.27
func (_c *MockSchemaGetter_ClusterHealthScore_Call) RunAndReturn(run func() int) *MockSchemaGetter_ClusterHealthScore_Call
type MockSchemaGetter_CopyShardingState_Call ¶ added in v1.27.27
MockSchemaGetter_CopyShardingState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CopyShardingState'
func (*MockSchemaGetter_CopyShardingState_Call) Return ¶ added in v1.27.27
func (_c *MockSchemaGetter_CopyShardingState_Call) Return(_a0 *sharding.State) *MockSchemaGetter_CopyShardingState_Call
func (*MockSchemaGetter_CopyShardingState_Call) Run ¶ added in v1.27.27
func (_c *MockSchemaGetter_CopyShardingState_Call) Run(run func(class string)) *MockSchemaGetter_CopyShardingState_Call
func (*MockSchemaGetter_CopyShardingState_Call) RunAndReturn ¶ added in v1.27.27
func (_c *MockSchemaGetter_CopyShardingState_Call) RunAndReturn(run func(string) *sharding.State) *MockSchemaGetter_CopyShardingState_Call
type MockSchemaGetter_Expecter ¶ added in v1.27.27
type MockSchemaGetter_Expecter struct {
// contains filtered or unexported fields
}
func (*MockSchemaGetter_Expecter) ClusterHealthScore ¶ added in v1.27.27
func (_e *MockSchemaGetter_Expecter) ClusterHealthScore() *MockSchemaGetter_ClusterHealthScore_Call
ClusterHealthScore is a helper method to define mock.On call
func (*MockSchemaGetter_Expecter) CopyShardingState ¶ added in v1.27.27
func (_e *MockSchemaGetter_Expecter) CopyShardingState(class interface{}) *MockSchemaGetter_CopyShardingState_Call
CopyShardingState is a helper method to define mock.On call
- class string
func (*MockSchemaGetter_Expecter) GetSchemaSkipAuth ¶ added in v1.27.27
func (_e *MockSchemaGetter_Expecter) GetSchemaSkipAuth() *MockSchemaGetter_GetSchemaSkipAuth_Call
GetSchemaSkipAuth is a helper method to define mock.On call
func (*MockSchemaGetter_Expecter) NodeName ¶ added in v1.27.27
func (_e *MockSchemaGetter_Expecter) NodeName() *MockSchemaGetter_NodeName_Call
NodeName is a helper method to define mock.On call
func (*MockSchemaGetter_Expecter) Nodes ¶ added in v1.27.27
func (_e *MockSchemaGetter_Expecter) Nodes() *MockSchemaGetter_Nodes_Call
Nodes is a helper method to define mock.On call
func (*MockSchemaGetter_Expecter) OptimisticTenantStatus ¶ added in v1.27.27
func (_e *MockSchemaGetter_Expecter) OptimisticTenantStatus(ctx interface{}, class interface{}, tenants interface{}) *MockSchemaGetter_OptimisticTenantStatus_Call
OptimisticTenantStatus is a helper method to define mock.On call
- ctx context.Context
- class string
- tenants string
func (*MockSchemaGetter_Expecter) ReadOnlyClass ¶ added in v1.27.27
func (_e *MockSchemaGetter_Expecter) ReadOnlyClass(_a0 interface{}) *MockSchemaGetter_ReadOnlyClass_Call
ReadOnlyClass is a helper method to define mock.On call
- _a0 string
func (*MockSchemaGetter_Expecter) ResolveAlias ¶ added in v1.32.0
func (_e *MockSchemaGetter_Expecter) ResolveAlias(_a0 interface{}) *MockSchemaGetter_ResolveAlias_Call
ResolveAlias is a helper method to define mock.On call
- _a0 string
func (*MockSchemaGetter_Expecter) ResolveParentNodes ¶ added in v1.27.27
func (_e *MockSchemaGetter_Expecter) ResolveParentNodes(_a0 interface{}, _a1 interface{}) *MockSchemaGetter_ResolveParentNodes_Call
ResolveParentNodes is a helper method to define mock.On call
- _a0 string
- _a1 string
func (*MockSchemaGetter_Expecter) ShardFromUUID ¶ added in v1.27.27
func (_e *MockSchemaGetter_Expecter) ShardFromUUID(class interface{}, uuid interface{}) *MockSchemaGetter_ShardFromUUID_Call
ShardFromUUID is a helper method to define mock.On call
- class string
- uuid []byte
func (*MockSchemaGetter_Expecter) ShardOwner ¶ added in v1.27.27
func (_e *MockSchemaGetter_Expecter) ShardOwner(class interface{}, shard interface{}) *MockSchemaGetter_ShardOwner_Call
ShardOwner is a helper method to define mock.On call
- class string
- shard string
func (*MockSchemaGetter_Expecter) ShardReplicas ¶ added in v1.27.27
func (_e *MockSchemaGetter_Expecter) ShardReplicas(class interface{}, shard interface{}) *MockSchemaGetter_ShardReplicas_Call
ShardReplicas is a helper method to define mock.On call
- class string
- shard string
func (*MockSchemaGetter_Expecter) Statistics ¶ added in v1.27.27
func (_e *MockSchemaGetter_Expecter) Statistics() *MockSchemaGetter_Statistics_Call
Statistics is a helper method to define mock.On call
func (*MockSchemaGetter_Expecter) TenantsShards ¶ added in v1.27.27
func (_e *MockSchemaGetter_Expecter) TenantsShards(ctx interface{}, class interface{}, tenants ...interface{}) *MockSchemaGetter_TenantsShards_Call
TenantsShards is a helper method to define mock.On call
- ctx context.Context
- class string
- tenants ...string
type MockSchemaGetter_GetSchemaSkipAuth_Call ¶ added in v1.27.27
MockSchemaGetter_GetSchemaSkipAuth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSchemaSkipAuth'
func (*MockSchemaGetter_GetSchemaSkipAuth_Call) Return ¶ added in v1.27.27
func (_c *MockSchemaGetter_GetSchemaSkipAuth_Call) Return(_a0 entitiesschema.Schema) *MockSchemaGetter_GetSchemaSkipAuth_Call
func (*MockSchemaGetter_GetSchemaSkipAuth_Call) Run ¶ added in v1.27.27
func (_c *MockSchemaGetter_GetSchemaSkipAuth_Call) Run(run func()) *MockSchemaGetter_GetSchemaSkipAuth_Call
func (*MockSchemaGetter_GetSchemaSkipAuth_Call) RunAndReturn ¶ added in v1.27.27
func (_c *MockSchemaGetter_GetSchemaSkipAuth_Call) RunAndReturn(run func() entitiesschema.Schema) *MockSchemaGetter_GetSchemaSkipAuth_Call
type MockSchemaGetter_NodeName_Call ¶ added in v1.27.27
MockSchemaGetter_NodeName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NodeName'
func (*MockSchemaGetter_NodeName_Call) Return ¶ added in v1.27.27
func (_c *MockSchemaGetter_NodeName_Call) Return(_a0 string) *MockSchemaGetter_NodeName_Call
func (*MockSchemaGetter_NodeName_Call) Run ¶ added in v1.27.27
func (_c *MockSchemaGetter_NodeName_Call) Run(run func()) *MockSchemaGetter_NodeName_Call
func (*MockSchemaGetter_NodeName_Call) RunAndReturn ¶ added in v1.27.27
func (_c *MockSchemaGetter_NodeName_Call) RunAndReturn(run func() string) *MockSchemaGetter_NodeName_Call
type MockSchemaGetter_Nodes_Call ¶ added in v1.27.27
MockSchemaGetter_Nodes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Nodes'
func (*MockSchemaGetter_Nodes_Call) Return ¶ added in v1.27.27
func (_c *MockSchemaGetter_Nodes_Call) Return(_a0 []string) *MockSchemaGetter_Nodes_Call
func (*MockSchemaGetter_Nodes_Call) Run ¶ added in v1.27.27
func (_c *MockSchemaGetter_Nodes_Call) Run(run func()) *MockSchemaGetter_Nodes_Call
func (*MockSchemaGetter_Nodes_Call) RunAndReturn ¶ added in v1.27.27
func (_c *MockSchemaGetter_Nodes_Call) RunAndReturn(run func() []string) *MockSchemaGetter_Nodes_Call
type MockSchemaGetter_OptimisticTenantStatus_Call ¶ added in v1.27.27
MockSchemaGetter_OptimisticTenantStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OptimisticTenantStatus'
func (*MockSchemaGetter_OptimisticTenantStatus_Call) Return ¶ added in v1.27.27
func (_c *MockSchemaGetter_OptimisticTenantStatus_Call) Return(_a0 map[string]string, _a1 error) *MockSchemaGetter_OptimisticTenantStatus_Call
func (*MockSchemaGetter_OptimisticTenantStatus_Call) Run ¶ added in v1.27.27
func (_c *MockSchemaGetter_OptimisticTenantStatus_Call) Run(run func(ctx context.Context, class string, tenants string)) *MockSchemaGetter_OptimisticTenantStatus_Call
func (*MockSchemaGetter_OptimisticTenantStatus_Call) RunAndReturn ¶ added in v1.27.27
func (_c *MockSchemaGetter_OptimisticTenantStatus_Call) RunAndReturn(run func(context.Context, string, string) (map[string]string, error)) *MockSchemaGetter_OptimisticTenantStatus_Call
type MockSchemaGetter_ReadOnlyClass_Call ¶ added in v1.27.27
MockSchemaGetter_ReadOnlyClass_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadOnlyClass'
func (*MockSchemaGetter_ReadOnlyClass_Call) Return ¶ added in v1.27.27
func (_c *MockSchemaGetter_ReadOnlyClass_Call) Return(_a0 *models.Class) *MockSchemaGetter_ReadOnlyClass_Call
func (*MockSchemaGetter_ReadOnlyClass_Call) Run ¶ added in v1.27.27
func (_c *MockSchemaGetter_ReadOnlyClass_Call) Run(run func(_a0 string)) *MockSchemaGetter_ReadOnlyClass_Call
func (*MockSchemaGetter_ReadOnlyClass_Call) RunAndReturn ¶ added in v1.27.27
func (_c *MockSchemaGetter_ReadOnlyClass_Call) RunAndReturn(run func(string) *models.Class) *MockSchemaGetter_ReadOnlyClass_Call
type MockSchemaGetter_ResolveAlias_Call ¶ added in v1.32.0
MockSchemaGetter_ResolveAlias_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResolveAlias'
func (*MockSchemaGetter_ResolveAlias_Call) Return ¶ added in v1.32.0
func (_c *MockSchemaGetter_ResolveAlias_Call) Return(_a0 string) *MockSchemaGetter_ResolveAlias_Call
func (*MockSchemaGetter_ResolveAlias_Call) Run ¶ added in v1.32.0
func (_c *MockSchemaGetter_ResolveAlias_Call) Run(run func(_a0 string)) *MockSchemaGetter_ResolveAlias_Call
func (*MockSchemaGetter_ResolveAlias_Call) RunAndReturn ¶ added in v1.32.0
func (_c *MockSchemaGetter_ResolveAlias_Call) RunAndReturn(run func(string) string) *MockSchemaGetter_ResolveAlias_Call
type MockSchemaGetter_ResolveParentNodes_Call ¶ added in v1.27.27
MockSchemaGetter_ResolveParentNodes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResolveParentNodes'
func (*MockSchemaGetter_ResolveParentNodes_Call) Return ¶ added in v1.27.27
func (_c *MockSchemaGetter_ResolveParentNodes_Call) Return(_a0 map[string]string, _a1 error) *MockSchemaGetter_ResolveParentNodes_Call
func (*MockSchemaGetter_ResolveParentNodes_Call) Run ¶ added in v1.27.27
func (_c *MockSchemaGetter_ResolveParentNodes_Call) Run(run func(_a0 string, _a1 string)) *MockSchemaGetter_ResolveParentNodes_Call
func (*MockSchemaGetter_ResolveParentNodes_Call) RunAndReturn ¶ added in v1.27.27
func (_c *MockSchemaGetter_ResolveParentNodes_Call) RunAndReturn(run func(string, string) (map[string]string, error)) *MockSchemaGetter_ResolveParentNodes_Call
type MockSchemaGetter_ShardFromUUID_Call ¶ added in v1.27.27
MockSchemaGetter_ShardFromUUID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ShardFromUUID'
func (*MockSchemaGetter_ShardFromUUID_Call) Return ¶ added in v1.27.27
func (_c *MockSchemaGetter_ShardFromUUID_Call) Return(_a0 string) *MockSchemaGetter_ShardFromUUID_Call
func (*MockSchemaGetter_ShardFromUUID_Call) Run ¶ added in v1.27.27
func (_c *MockSchemaGetter_ShardFromUUID_Call) Run(run func(class string, uuid []byte)) *MockSchemaGetter_ShardFromUUID_Call
func (*MockSchemaGetter_ShardFromUUID_Call) RunAndReturn ¶ added in v1.27.27
func (_c *MockSchemaGetter_ShardFromUUID_Call) RunAndReturn(run func(string, []byte) string) *MockSchemaGetter_ShardFromUUID_Call
type MockSchemaGetter_ShardOwner_Call ¶ added in v1.27.27
MockSchemaGetter_ShardOwner_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ShardOwner'
func (*MockSchemaGetter_ShardOwner_Call) Return ¶ added in v1.27.27
func (_c *MockSchemaGetter_ShardOwner_Call) Return(_a0 string, _a1 error) *MockSchemaGetter_ShardOwner_Call
func (*MockSchemaGetter_ShardOwner_Call) Run ¶ added in v1.27.27
func (_c *MockSchemaGetter_ShardOwner_Call) Run(run func(class string, shard string)) *MockSchemaGetter_ShardOwner_Call
func (*MockSchemaGetter_ShardOwner_Call) RunAndReturn ¶ added in v1.27.27
func (_c *MockSchemaGetter_ShardOwner_Call) RunAndReturn(run func(string, string) (string, error)) *MockSchemaGetter_ShardOwner_Call
type MockSchemaGetter_ShardReplicas_Call ¶ added in v1.27.27
MockSchemaGetter_ShardReplicas_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ShardReplicas'
func (*MockSchemaGetter_ShardReplicas_Call) Return ¶ added in v1.27.27
func (_c *MockSchemaGetter_ShardReplicas_Call) Return(_a0 []string, _a1 error) *MockSchemaGetter_ShardReplicas_Call
func (*MockSchemaGetter_ShardReplicas_Call) Run ¶ added in v1.27.27
func (_c *MockSchemaGetter_ShardReplicas_Call) Run(run func(class string, shard string)) *MockSchemaGetter_ShardReplicas_Call
func (*MockSchemaGetter_ShardReplicas_Call) RunAndReturn ¶ added in v1.27.27
func (_c *MockSchemaGetter_ShardReplicas_Call) RunAndReturn(run func(string, string) ([]string, error)) *MockSchemaGetter_ShardReplicas_Call
type MockSchemaGetter_Statistics_Call ¶ added in v1.27.27
MockSchemaGetter_Statistics_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Statistics'
func (*MockSchemaGetter_Statistics_Call) Return ¶ added in v1.27.27
func (_c *MockSchemaGetter_Statistics_Call) Return(_a0 map[string]interface{}) *MockSchemaGetter_Statistics_Call
func (*MockSchemaGetter_Statistics_Call) Run ¶ added in v1.27.27
func (_c *MockSchemaGetter_Statistics_Call) Run(run func()) *MockSchemaGetter_Statistics_Call
func (*MockSchemaGetter_Statistics_Call) RunAndReturn ¶ added in v1.27.27
func (_c *MockSchemaGetter_Statistics_Call) RunAndReturn(run func() map[string]interface{}) *MockSchemaGetter_Statistics_Call
type MockSchemaGetter_TenantsShards_Call ¶ added in v1.27.27
MockSchemaGetter_TenantsShards_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TenantsShards'
func (*MockSchemaGetter_TenantsShards_Call) Return ¶ added in v1.27.27
func (_c *MockSchemaGetter_TenantsShards_Call) Return(_a0 map[string]string, _a1 error) *MockSchemaGetter_TenantsShards_Call
func (*MockSchemaGetter_TenantsShards_Call) Run ¶ added in v1.27.27
func (_c *MockSchemaGetter_TenantsShards_Call) Run(run func(ctx context.Context, class string, tenants ...string)) *MockSchemaGetter_TenantsShards_Call
func (*MockSchemaGetter_TenantsShards_Call) RunAndReturn ¶ added in v1.27.27
func (_c *MockSchemaGetter_TenantsShards_Call) RunAndReturn(run func(context.Context, string, ...string) (map[string]string, error)) *MockSchemaGetter_TenantsShards_Call
type ModuleConfig ¶
type ModuleConfig interface {
SetClassDefaults(class *models.Class)
SetSinglePropertyDefaults(class *models.Class, props ...*models.Property)
ValidateClass(ctx context.Context, class *models.Class) error
GetByName(name string) modulecapabilities.Module
IsGenerative(string) bool
IsReranker(string) bool
IsMultiVector(string) bool
}
type Parser ¶ added in v1.25.0
type Parser struct {
// contains filtered or unexported fields
}
func NewParser ¶ added in v1.25.0
func NewParser(cs clusterState, vCfg VectorConfigParser, v validator, modules modulesProvider) *Parser
type RefFinder ¶
type RefFinder struct {
// contains filtered or unexported fields
}
RefFinder is a helper that lists classes and their possible paths to to a desired target class.
For example if the target class is "car". It might list: - Person, drives, Car - Person, owns, Car - Person, friendsWith, Person, drives, Car etc.
It will stop at a preconfigured depth limit, to avoid infinite results, such as: - Person, friendsWith, Person, friendsWith, Person, ..., drives Car
func NewRefFinder ¶
NewRefFinder with SchemaGetter and depth limit
type SchemaGetter ¶
type SchemaGetter interface {
GetSchemaSkipAuth() schema.Schema
ReadOnlyClass(string) *models.Class
ResolveAlias(string) string
Nodes() []string
NodeName() string
ClusterHealthScore() int
ResolveParentNodes(string, string) (map[string]string, error)
Statistics() map[string]any
CopyShardingState(class string) *sharding.State
ShardOwner(class, shard string) (string, error)
TenantsShards(ctx context.Context, class string, tenants ...string) (map[string]string, error)
OptimisticTenantStatus(ctx context.Context, class string, tenants string) (map[string]string, error)
ShardFromUUID(class string, uuid []byte) string
ShardReplicas(class, shard string) ([]string, error)
}
type SchemaManager ¶ added in v1.25.5
type SchemaManager interface {
// Schema writes operation.
AddClass(ctx context.Context, cls *models.Class, ss *sharding.State) (uint64, error)
RestoreClass(ctx context.Context, cls *models.Class, ss *sharding.State) (uint64, error)
UpdateClass(ctx context.Context, cls *models.Class, ss *sharding.State) (uint64, error)
DeleteClass(ctx context.Context, name string) (uint64, error)
AddProperty(ctx context.Context, class string, p ...*models.Property) (uint64, error)
UpdateShardStatus(ctx context.Context, class, shard, status string) (uint64, error)
AddTenants(ctx context.Context, class string, req *command.AddTenantsRequest) (uint64, error)
UpdateTenants(ctx context.Context, class string, req *command.UpdateTenantsRequest) (uint64, error)
DeleteTenants(ctx context.Context, class string, req *command.DeleteTenantsRequest) (uint64, error)
// Cluster related operations
Join(_ context.Context, nodeID, raftAddr string, voter bool) error
Remove(_ context.Context, nodeID string) error
Stats() map[string]any
StorageCandidates() []string
StoreSchemaV1() error
// Strongly consistent schema read. These endpoints will emit a query to the leader to ensure that the data is read
// from an up to date schema.
QueryReadOnlyClasses(names ...string) (map[string]versioned.Class, error)
QuerySchema() (models.Schema, error)
QueryTenants(class string, tenants []string) ([]*models.Tenant, uint64, error)
QueryCollectionsCount() (int, error)
QueryShardOwner(class, shard string) (string, uint64, error)
QueryTenantsShards(class string, tenants ...string) (map[string]string, uint64, error)
QueryShardingState(class string) (*sharding.State, uint64, error)
QueryClassVersions(names ...string) (map[string]uint64, error)
// Aliases
CreateAlias(ctx context.Context, alias string, class *models.Class) (uint64, error)
ReplaceAlias(ctx context.Context, alias *models.Alias, newClass *models.Class) (uint64, error)
DeleteAlias(ctx context.Context, alias string) (uint64, error)
GetAliases(ctx context.Context, alias string, class *models.Class) ([]*models.Alias, error)
}
SchemaManager is responsible for consistent schema operations. It allows reading and writing the schema while directly talking to the leader, no matter which node it is. It also allows cluster related operations that can only be done on the leader (join/remove/stats/etc...) For details about each endpoint see github.com/weaviate/weaviate/cluster.Raft. For local schema lookup where eventual consistency is acceptable, see SchemaReader.
type SchemaReader ¶ added in v1.25.5
type SchemaReader interface {
// WaitForUpdate ensures that the local schema has caught up to version.
WaitForUpdate(ctx context.Context, version uint64) error
// These schema reads function reads the metadata immediately present in the local schema and can be eventually
// consistent.
// For details about each endpoint see [github.com/weaviate/weaviate/cluster/schema.SchemaReader].
ClassEqual(name string) string
MultiTenancy(class string) models.MultiTenancyConfig
ClassInfo(class string) (ci clusterSchema.ClassInfo)
ReadOnlyClass(name string) *models.Class
ReadOnlyVersionedClass(name string) versioned.Class
ReadOnlySchema() models.Schema
Aliases() map[string]string
CopyShardingState(class string) *sharding.State
ShardReplicas(class, shard string) ([]string, error)
ShardFromUUID(class string, uuid []byte) string
ShardOwner(class, shard string) (string, error)
Read(class string, reader func(*models.Class, *sharding.State) error) error
GetShardsStatus(class, tenant string) (models.ShardStatusList, error)
ResolveAlias(alias string) string
// These schema reads function (...WithVersion) return the metadata once the local schema has caught up to the
// version parameter. If version is 0 is behaves exactly the same as eventual consistent reads.
// For details about each endpoint see [github.com/weaviate/weaviate/cluster/schema.VersionedSchemaReader].
ClassInfoWithVersion(ctx context.Context, class string, version uint64) (clusterSchema.ClassInfo, error)
MultiTenancyWithVersion(ctx context.Context, class string, version uint64) (models.MultiTenancyConfig, error)
ReadOnlyClassWithVersion(ctx context.Context, class string, version uint64) (*models.Class, error)
ShardOwnerWithVersion(ctx context.Context, lass, shard string, version uint64) (string, error)
ShardFromUUIDWithVersion(ctx context.Context, class string, uuid []byte, version uint64) (string, error)
ShardReplicasWithVersion(ctx context.Context, class, shard string, version uint64) ([]string, error)
TenantsShardsWithVersion(ctx context.Context, version uint64, class string, tenants ...string) (map[string]string, error)
CopyShardingStateWithVersion(ctx context.Context, class string, version uint64) (*sharding.State, error)
}
SchemaReader allows reading the local schema with or without using a schema version.
type SchemaStore ¶ added in v1.20.0
type SchemaStore interface {
// Save saves the complete schema to the persistent storage
Save(ctx context.Context, schema State) error
// Load loads the complete schema from the persistent storage
Load(context.Context) (State, error)
}
SchemaStore is responsible for persisting the schema by providing support for both partial and complete schema updates Deprecated: instead schema now is persistent via RAFT see : usecase/schema/handler.go & cluster/store/store.go Load and save are left to support backward compatibility
type State ¶
type State struct {
ObjectSchema *models.Schema `json:"object"`
ShardingState map[string]*sharding.State
}
State is a cached copy of the schema that can also be saved into a remote storage, as specified by Repo
func (State) EqualEnough ¶ added in v1.24.9
type UpdateTenantPayload ¶ added in v1.25.0
type VectorConfigParser ¶
type VectorConfigParser func(in interface{}, vectorIndexType string, isMultiVector bool) (schemaConfig.VectorIndexConfig, error)