Documentation ¶
Index ¶
- Constants
- Variables
- func Diff(leftLabel string, left *State, rightLabel string, right *State) []string
- func Equal(s1, s2 *State) bool
- func UnmarshalTransaction(txType cluster.TransactionType, payload json.RawMessage) (interface{}, error)
- type AddClassPayload
- type AddPropertyPayload
- type DeleteClassPayload
- type InvertedConfigValidator
- type Manager
- func (m *Manager) AddClass(ctx context.Context, principal *models.Principal, class *models.Class) error
- func (m *Manager) AddClassProperty(ctx context.Context, principal *models.Principal, class string, ...) error
- func (m *Manager) ClusterHealthScore() int
- func (m *Manager) DeleteClass(ctx context.Context, principal *models.Principal, class string, force bool) error
- func (m *Manager) DeleteClassProperty(ctx context.Context, principal *models.Principal, class string, ...) error
- func (m *Manager) GetClass(ctx context.Context, principal *models.Principal, name string) (*models.Class, error)
- func (m *Manager) GetSchema(principal *models.Principal) (schema.Schema, error)
- func (m *Manager) GetSchemaSkipAuth() schema.Schema
- func (m *Manager) GetShardsStatus(ctx context.Context, principal *models.Principal, className string) (models.ShardStatusList, error)
- func (m *Manager) IndexedInverted(className, propertyName string) bool
- func (m *Manager) NodeName() string
- func (m *Manager) Nodes() []string
- func (m *Manager) RegisterSchemaUpdateCallback(callback func(updatedSchema schema.Schema))
- func (m *Manager) ResolveParentNodes(class, shardName string) (resolved, unresolved []string, err error)
- func (m *Manager) RestoreClass(ctx context.Context, d *backup.ClassDescriptor) error
- func (m *Manager) ShardingState(className string) *sharding.State
- func (s *Manager) TxManager() *cluster.TxManager
- func (m *Manager) UpdateClass(ctx context.Context, principal *models.Principal, className string, ...) error
- func (m *Manager) UpdateMeta(ctx context.Context, atContext strfmt.URI, maintainer strfmt.Email, ...) error
- func (m *Manager) UpdateObject(ctx context.Context, principal *models.Principal, name string, ...) error
- func (m *Manager) UpdateShardStatus(ctx context.Context, principal *models.Principal, ...) error
- type ModuleConfig
- type ReadSchemaPayload
- type RefFinder
- type Repo
- type SchemaGetter
- type State
- type UpdateClassPayload
- type VectorConfigParser
- type VectorizerValidator
Constants ¶
const ( // write-only AddClass cluster.TransactionType = "add_class" AddProperty cluster.TransactionType = "add_property" DeleteClass cluster.TransactionType = "delete_class" UpdateClass cluster.TransactionType = "update_class" // read-only ReadSchema cluster.TransactionType = "read_schema" DefaultTxTTL = 60 * time.Second )
Variables ¶
var ErrNotFound = errors.New("not found")
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 Equal ¶
Equal checks if both schemas are the same by first marshalling, then comparing their byte-representation
func UnmarshalTransaction ¶
func UnmarshalTransaction(txType cluster.TransactionType, payload json.RawMessage, ) (interface{}, error)
Types ¶
type AddClassPayload ¶
type AddPropertyPayload ¶
type DeleteClassPayload ¶
type InvertedConfigValidator ¶
type InvertedConfigValidator func(in *models.InvertedIndexConfig) error
type Manager ¶
type Manager struct { RestoreStatus sync.Map RestoreError sync.Map sync.RWMutex // 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(migrator migrate.Migrator, repo Repo, logger logrus.FieldLogger, authorizer authorizer, config config.Config, hnswConfigParser VectorConfigParser, vectorizerValidator VectorizerValidator, invertedConfigValidator InvertedConfigValidator, moduleConfig ModuleConfig, clusterState clusterState, txClient cluster.Client, scaleoutManager scaleOut, ) (*Manager, error)
NewManager creates a new manager
func (*Manager) AddClass ¶
func (m *Manager) AddClass(ctx context.Context, principal *models.Principal, class *models.Class, ) error
AddClass to the schema
func (*Manager) AddClassProperty ¶
func (m *Manager) AddClassProperty(ctx context.Context, principal *models.Principal, class string, property *models.Property, ) error
AddClassProperty to an existing Class
func (*Manager) ClusterHealthScore ¶
func (*Manager) DeleteClass ¶
func (m *Manager) DeleteClass(ctx context.Context, principal *models.Principal, class string, force bool) error
DeleteClass from the schema
func (*Manager) DeleteClassProperty ¶
func (m *Manager) DeleteClassProperty(ctx context.Context, principal *models.Principal, class string, property string, ) error
DeleteClassProperty from existing Schema
func (*Manager) GetSchemaSkipAuth ¶
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 (*Manager) GetShardsStatus ¶
func (*Manager) IndexedInverted ¶
func (*Manager) RegisterSchemaUpdateCallback ¶
RegisterSchemaUpdateCallback allows other usecases to register a primitive type update callback. The callbacks will be called any time we persist a schema upadate
func (*Manager) ResolveParentNodes ¶ added in v1.18.0
func (m *Manager) ResolveParentNodes(class, shardName string, ) (resolved, unresolved []string, err error)
ResolveParentNodes resolves the hostname for each node a shard belongs to
If the hostname cannot be resolved for a given node, the name of the node is returned instead.
func (*Manager) RestoreClass ¶
func (*Manager) UpdateClass ¶
func (*Manager) UpdateMeta ¶
func (m *Manager) UpdateMeta(ctx context.Context, atContext strfmt.URI, maintainer strfmt.Email, name string, ) error
UpdateMeta for object
type ModuleConfig ¶
type ReadSchemaPayload ¶
type ReadSchemaPayload struct {
Schema *State `json:"schema"`
}
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 Repo ¶
type Repo interface { SaveSchema(ctx context.Context, schema State) error // should return nil (and no error) to indicate that no remote schema had // been stored before LoadSchema(ctx context.Context) (*State, error) }
Repo describes the requirements the schema manager has to a database to load and persist the schema state
type SchemaGetter ¶
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
type UpdateClassPayload ¶
type UpdateClassPayload struct { ClassName string `json:"className"` Class *models.Class `json:"class"` // For now, the state cannot be updated yet, but this will be a requirement // in the future, for example, with dynamically changing replication, so we // should already make sure that state is part of the transaction payload State *sharding.State `json:"state"` }
type VectorConfigParser ¶
type VectorConfigParser func(in interface{}) (schema.VectorIndexConfig, error)
type VectorizerValidator ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
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
|
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 |