Documentation
¶
Index ¶
- Variables
- func LegacySnapshot(nodeID string, m map[string]types.ClassState) (*raft.SnapshotMeta, io.ReadCloser, error)
- func MergeProps(old, new []*models.Property) []*models.Property
- func NewSchema(nodeID string, shardReader shardReader, reg prometheus.Registerer) *schema
- type ClassInfo
- type Indexer
- type LoadLegacySchema
- type MockParser
- type MockParser_Expecter
- type MockParser_ParseClassUpdate_Call
- func (_c *MockParser_ParseClassUpdate_Call) Return(_a0 *models.Class, _a1 error) *MockParser_ParseClassUpdate_Call
- func (_c *MockParser_ParseClassUpdate_Call) Run(run func(class *models.Class, update *models.Class)) *MockParser_ParseClassUpdate_Call
- func (_c *MockParser_ParseClassUpdate_Call) RunAndReturn(run func(*models.Class, *models.Class) (*models.Class, error)) *MockParser_ParseClassUpdate_Call
- type MockParser_ParseClass_Call
- type MockreplicationFSM
- func (_m *MockreplicationFSM) DeleteReplicationsByCollection(collection string) error
- func (_m *MockreplicationFSM) DeleteReplicationsByTenants(collection string, tenants []string) error
- func (_m *MockreplicationFSM) EXPECT() *MockreplicationFSM_Expecter
- func (_m *MockreplicationFSM) HasOngoingReplication(collection string, shard string, replica string) bool
- func (_m *MockreplicationFSM) SetUnCancellable(id uint64) error
- type MockreplicationFSM_DeleteReplicationsByCollection_Call
- func (_c *MockreplicationFSM_DeleteReplicationsByCollection_Call) Return(_a0 error) *MockreplicationFSM_DeleteReplicationsByCollection_Call
- func (_c *MockreplicationFSM_DeleteReplicationsByCollection_Call) Run(run func(collection string)) *MockreplicationFSM_DeleteReplicationsByCollection_Call
- func (_c *MockreplicationFSM_DeleteReplicationsByCollection_Call) RunAndReturn(run func(string) error) *MockreplicationFSM_DeleteReplicationsByCollection_Call
- type MockreplicationFSM_DeleteReplicationsByTenants_Call
- func (_c *MockreplicationFSM_DeleteReplicationsByTenants_Call) Return(_a0 error) *MockreplicationFSM_DeleteReplicationsByTenants_Call
- func (_c *MockreplicationFSM_DeleteReplicationsByTenants_Call) Run(run func(collection string, tenants []string)) *MockreplicationFSM_DeleteReplicationsByTenants_Call
- func (_c *MockreplicationFSM_DeleteReplicationsByTenants_Call) RunAndReturn(run func(string, []string) error) *MockreplicationFSM_DeleteReplicationsByTenants_Call
- type MockreplicationFSM_Expecter
- func (_e *MockreplicationFSM_Expecter) DeleteReplicationsByCollection(collection interface{}) *MockreplicationFSM_DeleteReplicationsByCollection_Call
- func (_e *MockreplicationFSM_Expecter) DeleteReplicationsByTenants(collection interface{}, tenants interface{}) *MockreplicationFSM_DeleteReplicationsByTenants_Call
- func (_e *MockreplicationFSM_Expecter) HasOngoingReplication(collection interface{}, shard interface{}, replica interface{}) *MockreplicationFSM_HasOngoingReplication_Call
- func (_e *MockreplicationFSM_Expecter) SetUnCancellable(id interface{}) *MockreplicationFSM_SetUnCancellable_Call
- type MockreplicationFSM_HasOngoingReplication_Call
- func (_c *MockreplicationFSM_HasOngoingReplication_Call) Return(_a0 bool) *MockreplicationFSM_HasOngoingReplication_Call
- func (_c *MockreplicationFSM_HasOngoingReplication_Call) Run(run func(collection string, shard string, replica string)) *MockreplicationFSM_HasOngoingReplication_Call
- func (_c *MockreplicationFSM_HasOngoingReplication_Call) RunAndReturn(run func(string, string, string) bool) *MockreplicationFSM_HasOngoingReplication_Call
- type MockreplicationFSM_SetUnCancellable_Call
- func (_c *MockreplicationFSM_SetUnCancellable_Call) Return(_a0 error) *MockreplicationFSM_SetUnCancellable_Call
- func (_c *MockreplicationFSM_SetUnCancellable_Call) Run(run func(id uint64)) *MockreplicationFSM_SetUnCancellable_Call
- func (_c *MockreplicationFSM_SetUnCancellable_Call) RunAndReturn(run func(uint64) error) *MockreplicationFSM_SetUnCancellable_Call
- type NodeShardProcess
- type Parser
- type SaveLegacySchema
- type SchemaManager
- func (s *SchemaManager) AddClass(cmd *command.ApplyRequest, nodeID string, schemaOnly bool, ...) error
- func (s *SchemaManager) AddProperty(cmd *command.ApplyRequest, schemaOnly bool, enableSchemaCallback bool) error
- func (s *SchemaManager) AddReplicaToShard(cmd *command.ApplyRequest, schemaOnly bool) error
- func (s *SchemaManager) AddTenants(cmd *command.ApplyRequest, schemaOnly bool) error
- func (s *SchemaManager) Close(ctx context.Context) (err error)
- func (s *SchemaManager) DeleteClass(cmd *command.ApplyRequest, schemaOnly bool, enableSchemaCallback bool) error
- func (s *SchemaManager) DeleteReplicaFromShard(cmd *command.ApplyRequest, schemaOnly bool) error
- func (s *SchemaManager) DeleteTenants(cmd *command.ApplyRequest, schemaOnly bool) error
- func (s *SchemaManager) Load(ctx context.Context, nodeID string) error
- func (s *SchemaManager) NewSchemaReader() SchemaReader
- func (s *SchemaManager) NewSchemaReaderWithWaitFunc(f func(context.Context, uint64) error) SchemaReader
- func (s *SchemaManager) PreApplyFilter(req *command.ApplyRequest) error
- func (sm *SchemaManager) QueryClassVersions(req *cmd.QueryRequest) ([]byte, error)
- func (sm *SchemaManager) QueryCollectionsCount() ([]byte, error)
- func (sm *SchemaManager) QueryReadOnlyClasses(req *cmd.QueryRequest) ([]byte, error)
- func (sm *SchemaManager) QuerySchema() ([]byte, error)
- func (sm *SchemaManager) QueryShardOwner(req *cmd.QueryRequest) ([]byte, error)
- func (sm *SchemaManager) QueryShardingState(req *cmd.QueryRequest) ([]byte, error)
- func (sm *SchemaManager) QueryTenants(req *cmd.QueryRequest) ([]byte, error)
- func (sm *SchemaManager) QueryTenantsShards(req *cmd.QueryRequest) ([]byte, error)
- func (s *SchemaManager) ReloadDBFromSchema()
- func (s *SchemaManager) ReplaceStatesNodeName(new string)
- func (s *SchemaManager) ReplicationAddReplicaToShard(cmd *command.ApplyRequest, schemaOnly bool) error
- func (s *SchemaManager) Restore(data []byte, parser Parser) error
- func (s *SchemaManager) RestoreClass(cmd *command.ApplyRequest, nodeID string, schemaOnly bool, ...) error
- func (s *SchemaManager) RestoreLegacy(data []byte, parser Parser) error
- func (s *SchemaManager) SetIndexer(idx Indexer)
- func (s *SchemaManager) SetReplicationFSM(fsm replicationFSM)
- func (s *SchemaManager) Snapshot() ([]byte, error)
- func (s *SchemaManager) SyncShard(cmd *command.ApplyRequest, schemaOnly bool) error
- func (s *SchemaManager) UpdateClass(cmd *command.ApplyRequest, nodeID string, schemaOnly bool, ...) error
- func (s *SchemaManager) UpdateShardStatus(cmd *command.ApplyRequest, schemaOnly bool) error
- func (s *SchemaManager) UpdateTenants(cmd *command.ApplyRequest, schemaOnly bool) error
- func (s *SchemaManager) UpdateTenantsProcess(cmd *command.ApplyRequest, schemaOnly bool) error
- type SchemaReader
- func (rs SchemaReader) ClassEqual(name string) string
- func (rs SchemaReader) ClassInfo(class string) (ci ClassInfo)
- func (rs SchemaReader) ClassInfoWithVersion(ctx context.Context, class string, version uint64) (ci ClassInfo, err error)
- func (rs SchemaReader) CopyShardingState(class string) (ss *sharding.State)
- func (rs SchemaReader) CopyShardingStateWithVersion(ctx context.Context, class string, version uint64) (ss *sharding.State, err error)
- func (rs SchemaReader) GetShardsStatus(class, tenant string) (models.ShardStatusList, error)
- func (rs SchemaReader) Len() int
- func (rs SchemaReader) MultiTenancy(class string) models.MultiTenancyConfig
- func (rs SchemaReader) MultiTenancyWithVersion(ctx context.Context, class string, version uint64) (models.MultiTenancyConfig, error)
- func (rs SchemaReader) Read(class string, reader func(*models.Class, *sharding.State) error) error
- func (rs SchemaReader) ReadOnlyClass(class string) (cls *models.Class)
- func (rs SchemaReader) ReadOnlyClassWithVersion(ctx context.Context, class string, version uint64) (cls *models.Class, err error)
- func (rs SchemaReader) ReadOnlySchema() models.Schema
- func (rs SchemaReader) ReadOnlyVersionedClass(className string) versioned.Class
- func (rs SchemaReader) ShardFromUUID(class string, uuid []byte) (shard string)
- func (rs SchemaReader) ShardFromUUIDWithVersion(ctx context.Context, class string, uuid []byte, version uint64) (shard string, err error)
- func (rs SchemaReader) ShardOwner(class, shard string) (owner string, err error)
- func (rs SchemaReader) ShardOwnerWithVersion(ctx context.Context, class, shard string, version uint64) (owner string, err error)
- func (rs SchemaReader) ShardReplicas(class, shard string) (nodes []string, err error)
- func (rs SchemaReader) ShardReplicasWithVersion(ctx context.Context, class, shard string, version uint64) (nodes []string, err error)
- func (rs SchemaReader) States() map[string]types.ClassState
- func (rs SchemaReader) TenantsShards(class string, tenants ...string) (map[string]string, error)
- func (rs SchemaReader) TenantsShardsWithVersion(ctx context.Context, version uint64, class string, tenants ...string) (tenantShards map[string]string, err error)
- func (rs SchemaReader) WaitForUpdate(ctx context.Context, version uint64) error
- type VersionedSchemaReader
- func (s VersionedSchemaReader) ClassEqual(name string) string
- func (s VersionedSchemaReader) ClassInfo(ctx context.Context, class string, v uint64) (ClassInfo, error)
- func (s VersionedSchemaReader) CopyShardingState(ctx context.Context, class string, v uint64) (*sharding.State, error)
- func (s VersionedSchemaReader) Len() int
- func (s VersionedSchemaReader) MultiTenancy(ctx context.Context, class string, v uint64) (models.MultiTenancyConfig, error)
- func (s VersionedSchemaReader) Read(ctx context.Context, class string, v uint64, ...) error
- func (s VersionedSchemaReader) ReadOnlyClass(ctx context.Context, class string, v uint64) (*models.Class, error)
- func (s VersionedSchemaReader) ShardFromUUID(ctx context.Context, class string, uuid []byte, v uint64) (string, error)
- func (s VersionedSchemaReader) ShardOwner(ctx context.Context, class, shard string, v uint64) (string, error)
- func (s VersionedSchemaReader) ShardReplicas(ctx context.Context, class, shard string, v uint64) ([]string, error)
- func (s VersionedSchemaReader) TenantsShards(ctx context.Context, v uint64, class string, tenants ...string) (map[string]string, uint64, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadRequest = errors.New("bad request") ErrSchema = errors.New("updating schema") )
Functions ¶
func LegacySnapshot ¶
func LegacySnapshot(nodeID string, m map[string]types.ClassState) (*raft.SnapshotMeta, io.ReadCloser, error)
LegacySnapshot returns a ready-to-use in-memory Raft snapshot based on the provided legacy schema
func MergeProps ¶
MergeProps makes sure duplicates are not created by ignoring new props with the same names as old props. If property of nested type is present in both new and old slices, final property is created by merging new property into copy of old one
func NewSchema ¶
func NewSchema(nodeID string, shardReader shardReader, reg prometheus.Registerer) *schema
Types ¶
type ClassInfo ¶
type Indexer ¶
type Indexer interface {
AddClass(api.AddClassRequest) error
UpdateClass(api.UpdateClassRequest) error
DeleteClass(className string, hasFrozen bool) error
AddProperty(class string, req api.AddPropertyRequest) error
AddTenants(class string, req *api.AddTenantsRequest) error
UpdateTenants(class string, req *api.UpdateTenantsRequest) error
DeleteTenants(class string, tenants []*models.Tenant) error
UpdateTenantsProcess(class string, req *api.TenantProcessRequest) error
UpdateShardStatus(*api.UpdateShardStatusRequest) error
AddReplicaToShard(class, shard, targetNode string) error
DeleteReplicaFromShard(class, shard, targetNode string) error
LoadShard(class, shard string) // is a no-op
ShutdownShard(class, shard string) // is a no-op
DropShard(class, shard string) // is a no-op
GetShardsStatus(class, tenant string) (models.ShardStatusList, error)
UpdateIndex(api.UpdateClassRequest) error
TriggerSchemaUpdateCallbacks()
// ReloadLocalDB reloads the local database using the latest schema.
ReloadLocalDB(ctx context.Context, all []api.UpdateClassRequest) error
// RestoreClassDir restores classes on the filesystem directly from the temporary class backup stored on disk.
RestoreClassDir(class string) error
Open(context.Context) error
Close(context.Context) error
}
Indexer interface updates both the collection and its indices in the filesystem. This is distinct from updating metadata, which is handled through a different interface.
type LoadLegacySchema ¶
type LoadLegacySchema func() (map[string]types.ClassState, error)
LoadLegacySchema returns the legacy schema
type MockParser ¶ added in v1.29.9
MockParser is an autogenerated mock type for the Parser type
func NewMockParser ¶ added in v1.29.9
func NewMockParser(t interface {
mock.TestingT
Cleanup(func())
}) *MockParser
NewMockParser creates a new instance of MockParser. 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 (*MockParser) EXPECT ¶ added in v1.29.9
func (_m *MockParser) EXPECT() *MockParser_Expecter
func (*MockParser) ParseClass ¶ added in v1.29.9
func (_m *MockParser) ParseClass(class *models.Class) error
ParseClass provides a mock function with given fields: class
func (*MockParser) ParseClassUpdate ¶ added in v1.29.9
func (_m *MockParser) ParseClassUpdate(class *models.Class, update *models.Class) (*models.Class, error)
ParseClassUpdate provides a mock function with given fields: class, update
type MockParser_Expecter ¶ added in v1.29.9
type MockParser_Expecter struct {
// contains filtered or unexported fields
}
func (*MockParser_Expecter) ParseClass ¶ added in v1.29.9
func (_e *MockParser_Expecter) ParseClass(class interface{}) *MockParser_ParseClass_Call
ParseClass is a helper method to define mock.On call
- class *models.Class
func (*MockParser_Expecter) ParseClassUpdate ¶ added in v1.29.9
func (_e *MockParser_Expecter) ParseClassUpdate(class interface{}, update interface{}) *MockParser_ParseClassUpdate_Call
ParseClassUpdate is a helper method to define mock.On call
- class *models.Class
- update *models.Class
type MockParser_ParseClassUpdate_Call ¶ added in v1.29.9
MockParser_ParseClassUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseClassUpdate'
func (*MockParser_ParseClassUpdate_Call) Return ¶ added in v1.29.9
func (_c *MockParser_ParseClassUpdate_Call) Return(_a0 *models.Class, _a1 error) *MockParser_ParseClassUpdate_Call
func (*MockParser_ParseClassUpdate_Call) Run ¶ added in v1.29.9
func (_c *MockParser_ParseClassUpdate_Call) Run(run func(class *models.Class, update *models.Class)) *MockParser_ParseClassUpdate_Call
func (*MockParser_ParseClassUpdate_Call) RunAndReturn ¶ added in v1.29.9
func (_c *MockParser_ParseClassUpdate_Call) RunAndReturn(run func(*models.Class, *models.Class) (*models.Class, error)) *MockParser_ParseClassUpdate_Call
type MockParser_ParseClass_Call ¶ added in v1.29.9
MockParser_ParseClass_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseClass'
func (*MockParser_ParseClass_Call) Return ¶ added in v1.29.9
func (_c *MockParser_ParseClass_Call) Return(_a0 error) *MockParser_ParseClass_Call
func (*MockParser_ParseClass_Call) Run ¶ added in v1.29.9
func (_c *MockParser_ParseClass_Call) Run(run func(class *models.Class)) *MockParser_ParseClass_Call
func (*MockParser_ParseClass_Call) RunAndReturn ¶ added in v1.29.9
func (_c *MockParser_ParseClass_Call) RunAndReturn(run func(*models.Class) error) *MockParser_ParseClass_Call
type MockreplicationFSM ¶ added in v1.31.0
MockreplicationFSM is an autogenerated mock type for the replicationFSM type
func NewMockreplicationFSM ¶ added in v1.31.0
func NewMockreplicationFSM(t interface {
mock.TestingT
Cleanup(func())
}) *MockreplicationFSM
NewMockreplicationFSM creates a new instance of MockreplicationFSM. 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 (*MockreplicationFSM) DeleteReplicationsByCollection ¶ added in v1.31.0
func (_m *MockreplicationFSM) DeleteReplicationsByCollection(collection string) error
DeleteReplicationsByCollection provides a mock function with given fields: collection
func (*MockreplicationFSM) DeleteReplicationsByTenants ¶ added in v1.31.0
func (_m *MockreplicationFSM) DeleteReplicationsByTenants(collection string, tenants []string) error
DeleteReplicationsByTenants provides a mock function with given fields: collection, tenants
func (*MockreplicationFSM) EXPECT ¶ added in v1.31.0
func (_m *MockreplicationFSM) EXPECT() *MockreplicationFSM_Expecter
func (*MockreplicationFSM) HasOngoingReplication ¶ added in v1.31.0
func (_m *MockreplicationFSM) HasOngoingReplication(collection string, shard string, replica string) bool
HasOngoingReplication provides a mock function with given fields: collection, shard, replica
func (*MockreplicationFSM) SetUnCancellable ¶ added in v1.31.0
func (_m *MockreplicationFSM) SetUnCancellable(id uint64) error
SetUnCancellable provides a mock function with given fields: id
type MockreplicationFSM_DeleteReplicationsByCollection_Call ¶ added in v1.31.0
MockreplicationFSM_DeleteReplicationsByCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteReplicationsByCollection'
func (*MockreplicationFSM_DeleteReplicationsByCollection_Call) Run ¶ added in v1.31.0
func (_c *MockreplicationFSM_DeleteReplicationsByCollection_Call) Run(run func(collection string)) *MockreplicationFSM_DeleteReplicationsByCollection_Call
func (*MockreplicationFSM_DeleteReplicationsByCollection_Call) RunAndReturn ¶ added in v1.31.0
func (_c *MockreplicationFSM_DeleteReplicationsByCollection_Call) RunAndReturn(run func(string) error) *MockreplicationFSM_DeleteReplicationsByCollection_Call
type MockreplicationFSM_DeleteReplicationsByTenants_Call ¶ added in v1.31.0
MockreplicationFSM_DeleteReplicationsByTenants_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteReplicationsByTenants'
func (*MockreplicationFSM_DeleteReplicationsByTenants_Call) Run ¶ added in v1.31.0
func (_c *MockreplicationFSM_DeleteReplicationsByTenants_Call) Run(run func(collection string, tenants []string)) *MockreplicationFSM_DeleteReplicationsByTenants_Call
func (*MockreplicationFSM_DeleteReplicationsByTenants_Call) RunAndReturn ¶ added in v1.31.0
func (_c *MockreplicationFSM_DeleteReplicationsByTenants_Call) RunAndReturn(run func(string, []string) error) *MockreplicationFSM_DeleteReplicationsByTenants_Call
type MockreplicationFSM_Expecter ¶ added in v1.31.0
type MockreplicationFSM_Expecter struct {
// contains filtered or unexported fields
}
func (*MockreplicationFSM_Expecter) DeleteReplicationsByCollection ¶ added in v1.31.0
func (_e *MockreplicationFSM_Expecter) DeleteReplicationsByCollection(collection interface{}) *MockreplicationFSM_DeleteReplicationsByCollection_Call
DeleteReplicationsByCollection is a helper method to define mock.On call
- collection string
func (*MockreplicationFSM_Expecter) DeleteReplicationsByTenants ¶ added in v1.31.0
func (_e *MockreplicationFSM_Expecter) DeleteReplicationsByTenants(collection interface{}, tenants interface{}) *MockreplicationFSM_DeleteReplicationsByTenants_Call
DeleteReplicationsByTenants is a helper method to define mock.On call
- collection string
- tenants []string
func (*MockreplicationFSM_Expecter) HasOngoingReplication ¶ added in v1.31.0
func (_e *MockreplicationFSM_Expecter) HasOngoingReplication(collection interface{}, shard interface{}, replica interface{}) *MockreplicationFSM_HasOngoingReplication_Call
HasOngoingReplication is a helper method to define mock.On call
- collection string
- shard string
- replica string
func (*MockreplicationFSM_Expecter) SetUnCancellable ¶ added in v1.31.0
func (_e *MockreplicationFSM_Expecter) SetUnCancellable(id interface{}) *MockreplicationFSM_SetUnCancellable_Call
SetUnCancellable is a helper method to define mock.On call
- id uint64
type MockreplicationFSM_HasOngoingReplication_Call ¶ added in v1.31.0
MockreplicationFSM_HasOngoingReplication_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasOngoingReplication'
func (*MockreplicationFSM_HasOngoingReplication_Call) Return ¶ added in v1.31.0
func (_c *MockreplicationFSM_HasOngoingReplication_Call) Return(_a0 bool) *MockreplicationFSM_HasOngoingReplication_Call
func (*MockreplicationFSM_HasOngoingReplication_Call) Run ¶ added in v1.31.0
func (_c *MockreplicationFSM_HasOngoingReplication_Call) Run(run func(collection string, shard string, replica string)) *MockreplicationFSM_HasOngoingReplication_Call
func (*MockreplicationFSM_HasOngoingReplication_Call) RunAndReturn ¶ added in v1.31.0
func (_c *MockreplicationFSM_HasOngoingReplication_Call) RunAndReturn(run func(string, string, string) bool) *MockreplicationFSM_HasOngoingReplication_Call
type MockreplicationFSM_SetUnCancellable_Call ¶ added in v1.31.0
MockreplicationFSM_SetUnCancellable_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetUnCancellable'
func (*MockreplicationFSM_SetUnCancellable_Call) Return ¶ added in v1.31.0
func (_c *MockreplicationFSM_SetUnCancellable_Call) Return(_a0 error) *MockreplicationFSM_SetUnCancellable_Call
func (*MockreplicationFSM_SetUnCancellable_Call) Run ¶ added in v1.31.0
func (_c *MockreplicationFSM_SetUnCancellable_Call) Run(run func(id uint64)) *MockreplicationFSM_SetUnCancellable_Call
func (*MockreplicationFSM_SetUnCancellable_Call) RunAndReturn ¶ added in v1.31.0
func (_c *MockreplicationFSM_SetUnCancellable_Call) RunAndReturn(run func(uint64) error) *MockreplicationFSM_SetUnCancellable_Call
type NodeShardProcess ¶ added in v1.26.0
type NodeShardProcess map[string]*command.TenantsProcess
type Parser ¶
type Parser interface {
// ParseClassUpdate parses a class after unmarshaling by setting concrete types for the fields
ParseClass(class *models.Class) error
// ParseClass parses new updates by providing the current class data.
ParseClassUpdate(class, update *models.Class) (*models.Class, error)
}
Parser parses concrete class fields after deserialization
type SaveLegacySchema ¶
type SaveLegacySchema func(map[string]types.ClassState) error
SaveLegacySchema saves the RAFT schema representation to the legacy storage
type SchemaManager ¶
type SchemaManager struct {
// contains filtered or unexported fields
}
func NewSchemaManager ¶
func NewSchemaManager(nodeId string, db Indexer, parser Parser, reg prometheus.Registerer, log *logrus.Logger) *SchemaManager
func (*SchemaManager) AddClass ¶
func (s *SchemaManager) AddClass(cmd *command.ApplyRequest, nodeID string, schemaOnly bool, enableSchemaCallback bool) error
func (*SchemaManager) AddProperty ¶
func (s *SchemaManager) AddProperty(cmd *command.ApplyRequest, schemaOnly bool, enableSchemaCallback bool) error
func (*SchemaManager) AddReplicaToShard ¶ added in v1.31.0
func (s *SchemaManager) AddReplicaToShard(cmd *command.ApplyRequest, schemaOnly bool) error
func (*SchemaManager) AddTenants ¶
func (s *SchemaManager) AddTenants(cmd *command.ApplyRequest, schemaOnly bool) error
func (*SchemaManager) DeleteClass ¶
func (s *SchemaManager) DeleteClass(cmd *command.ApplyRequest, schemaOnly bool, enableSchemaCallback bool) error
func (*SchemaManager) DeleteReplicaFromShard ¶ added in v1.31.0
func (s *SchemaManager) DeleteReplicaFromShard(cmd *command.ApplyRequest, schemaOnly bool) error
func (*SchemaManager) DeleteTenants ¶
func (s *SchemaManager) DeleteTenants(cmd *command.ApplyRequest, schemaOnly bool) error
func (*SchemaManager) NewSchemaReader ¶
func (s *SchemaManager) NewSchemaReader() SchemaReader
func (*SchemaManager) NewSchemaReaderWithWaitFunc ¶
func (s *SchemaManager) NewSchemaReaderWithWaitFunc(f func(context.Context, uint64) error) SchemaReader
func (*SchemaManager) PreApplyFilter ¶
func (s *SchemaManager) PreApplyFilter(req *command.ApplyRequest) error
func (*SchemaManager) QueryClassVersions ¶ added in v1.27.11
func (sm *SchemaManager) QueryClassVersions(req *cmd.QueryRequest) ([]byte, error)
QueryClassVersions returns the versions of the requested classes
func (*SchemaManager) QueryCollectionsCount ¶ added in v1.30.0
func (sm *SchemaManager) QueryCollectionsCount() ([]byte, error)
func (*SchemaManager) QueryReadOnlyClasses ¶
func (sm *SchemaManager) QueryReadOnlyClasses(req *cmd.QueryRequest) ([]byte, error)
func (*SchemaManager) QuerySchema ¶
func (sm *SchemaManager) QuerySchema() ([]byte, error)
func (*SchemaManager) QueryShardOwner ¶
func (sm *SchemaManager) QueryShardOwner(req *cmd.QueryRequest) ([]byte, error)
func (*SchemaManager) QueryShardingState ¶
func (sm *SchemaManager) QueryShardingState(req *cmd.QueryRequest) ([]byte, error)
func (*SchemaManager) QueryTenants ¶
func (sm *SchemaManager) QueryTenants(req *cmd.QueryRequest) ([]byte, error)
func (*SchemaManager) QueryTenantsShards ¶
func (sm *SchemaManager) QueryTenantsShards(req *cmd.QueryRequest) ([]byte, error)
func (*SchemaManager) ReloadDBFromSchema ¶
func (s *SchemaManager) ReloadDBFromSchema()
func (*SchemaManager) ReplaceStatesNodeName ¶ added in v1.25.12
func (s *SchemaManager) ReplaceStatesNodeName(new string)
ReplaceStatesNodeName it update the node name inside sharding states. WARNING: this shall be used in one node cluster environments only. because it will replace the shard node name if the node name got updated only if the replication factor is 1, otherwise it's no-op
func (*SchemaManager) ReplicationAddReplicaToShard ¶ added in v1.31.0
func (s *SchemaManager) ReplicationAddReplicaToShard(cmd *command.ApplyRequest, schemaOnly bool) error
func (*SchemaManager) RestoreClass ¶
func (s *SchemaManager) RestoreClass(cmd *command.ApplyRequest, nodeID string, schemaOnly bool, enableSchemaCallback bool) error
func (*SchemaManager) RestoreLegacy ¶ added in v1.28.13
func (s *SchemaManager) RestoreLegacy(data []byte, parser Parser) error
func (*SchemaManager) SetIndexer ¶
func (s *SchemaManager) SetIndexer(idx Indexer)
func (*SchemaManager) SetReplicationFSM ¶ added in v1.31.0
func (s *SchemaManager) SetReplicationFSM(fsm replicationFSM)
func (*SchemaManager) Snapshot ¶
func (s *SchemaManager) Snapshot() ([]byte, error)
func (*SchemaManager) SyncShard ¶ added in v1.31.0
func (s *SchemaManager) SyncShard(cmd *command.ApplyRequest, schemaOnly bool) error
func (*SchemaManager) UpdateClass ¶
func (s *SchemaManager) UpdateClass(cmd *command.ApplyRequest, nodeID string, schemaOnly bool, enableSchemaCallback bool) error
UpdateClass modifies the vectors and inverted indexes associated with a class Other class properties are handled by separate functions
func (*SchemaManager) UpdateShardStatus ¶
func (s *SchemaManager) UpdateShardStatus(cmd *command.ApplyRequest, schemaOnly bool) error
func (*SchemaManager) UpdateTenants ¶
func (s *SchemaManager) UpdateTenants(cmd *command.ApplyRequest, schemaOnly bool) error
func (*SchemaManager) UpdateTenantsProcess ¶ added in v1.26.0
func (s *SchemaManager) UpdateTenantsProcess(cmd *command.ApplyRequest, schemaOnly bool) error
type SchemaReader ¶
type SchemaReader struct {
// contains filtered or unexported fields
}
SchemaReader is used for retrying schema queries. It is a thin wrapper around the original schema, separating retry logic from the actual operation. Retry may be needed due to eventual consistency issues where updates might take some time to arrive at the follower.
func NewSchemaReader ¶ added in v1.31.0
func NewSchemaReader(sc *schema, vsr VersionedSchemaReader) SchemaReader
func NewSchemaReaderWithoutVersion ¶ added in v1.31.0
func NewSchemaReaderWithoutVersion(sc *schema) SchemaReader
func (SchemaReader) ClassEqual ¶
func (rs SchemaReader) ClassEqual(name string) string
ClassEqual returns the name of an existing class with a similar name, and "" otherwise strings.EqualFold is used to compare classes
func (SchemaReader) ClassInfo ¶
func (rs SchemaReader) ClassInfo(class string) (ci ClassInfo)
func (SchemaReader) ClassInfoWithVersion ¶
func (SchemaReader) CopyShardingState ¶
func (rs SchemaReader) CopyShardingState(class string) (ss *sharding.State)
func (SchemaReader) CopyShardingStateWithVersion ¶
func (SchemaReader) GetShardsStatus ¶
func (rs SchemaReader) GetShardsStatus(class, tenant string) (models.ShardStatusList, error)
func (SchemaReader) Len ¶
func (rs SchemaReader) Len() int
func (SchemaReader) MultiTenancy ¶
func (rs SchemaReader) MultiTenancy(class string) models.MultiTenancyConfig
func (SchemaReader) MultiTenancyWithVersion ¶
func (rs SchemaReader) MultiTenancyWithVersion(ctx context.Context, class string, version uint64) (models.MultiTenancyConfig, error)
func (SchemaReader) Read ¶
Read performs a read operation `reader` on the specified class and sharding state
func (SchemaReader) ReadOnlyClass ¶
func (rs SchemaReader) ReadOnlyClass(class string) (cls *models.Class)
ReadOnlyClass returns a shallow copy of a class. The copy is read-only and should not be modified.
func (SchemaReader) ReadOnlyClassWithVersion ¶
func (rs SchemaReader) ReadOnlyClassWithVersion(ctx context.Context, class string, version uint64) (cls *models.Class, err error)
ReadOnlyClass returns a shallow copy of a class. The copy is read-only and should not be modified.
func (SchemaReader) ReadOnlySchema ¶
func (rs SchemaReader) ReadOnlySchema() models.Schema
ReadOnlySchema returns a read only schema Changing the schema outside this package might lead to undefined behavior.
it creates a shallow copy of existing classes
This function assumes that class attributes are being overwritten. The properties attribute is the only one that might vary in size; therefore, we perform a shallow copy of the existing properties. This implementation assumes that individual properties are overwritten rather than partially updated
func (SchemaReader) ReadOnlyVersionedClass ¶ added in v1.27.11
func (rs SchemaReader) ReadOnlyVersionedClass(className string) versioned.Class
ReadOnlyVersionedClass returns a shallow copy of a class along with its version. The copy is read-only and should not be modified.
func (SchemaReader) ShardFromUUID ¶
func (rs SchemaReader) ShardFromUUID(class string, uuid []byte) (shard string)
ShardFromUUID returns shard name of the provided uuid
func (SchemaReader) ShardFromUUIDWithVersion ¶
func (rs SchemaReader) ShardFromUUIDWithVersion(ctx context.Context, class string, uuid []byte, version uint64) (shard string, err error)
ShardFromUUID returns shard name of the provided uuid
func (SchemaReader) ShardOwner ¶
func (rs SchemaReader) ShardOwner(class, shard string) (owner string, err error)
ShardOwner returns the node owner of the specified shard
func (SchemaReader) ShardOwnerWithVersion ¶
func (rs SchemaReader) ShardOwnerWithVersion(ctx context.Context, class, shard string, version uint64) (owner string, err error)
ShardOwner returns the node owner of the specified shard
func (SchemaReader) ShardReplicas ¶
func (rs SchemaReader) ShardReplicas(class, shard string) (nodes []string, err error)
ShardReplicas returns the replica nodes of a shard
func (SchemaReader) ShardReplicasWithVersion ¶
func (rs SchemaReader) ShardReplicasWithVersion(ctx context.Context, class, shard string, version uint64) (nodes []string, err error)
ShardReplicas returns the replica nodes of a shard
func (SchemaReader) States ¶
func (rs SchemaReader) States() map[string]types.ClassState
func (SchemaReader) TenantsShards ¶
TenantsShards returns shard name for the provided tenant and its activity status
func (SchemaReader) TenantsShardsWithVersion ¶
func (rs SchemaReader) TenantsShardsWithVersion(ctx context.Context, version uint64, class string, tenants ...string) (tenantShards map[string]string, err error)
TenantsShardsWithVersion returns shard name for the provided tenant and its activity status
func (SchemaReader) WaitForUpdate ¶
func (rs SchemaReader) WaitForUpdate(ctx context.Context, version uint64) error
type VersionedSchemaReader ¶
type VersionedSchemaReader struct {
WaitForUpdate func(ctx context.Context, version uint64) error
// contains filtered or unexported fields
}
VersionedSchemaReader is utilized to query the schema based on a specific update version. Serving as a thin wrapper around the original schema, it segregates waiting logic from the actual operation. It waits until it finds an update at least as up-to-date as the specified version. Note that updates may take some time to propagate to the follower, hence this process might take time.
func (VersionedSchemaReader) ClassEqual ¶
func (s VersionedSchemaReader) ClassEqual(name string) string
ClassEqual returns the name of an existing class with a similar name, and "" otherwise strings.EqualFold is used to compare classes
func (VersionedSchemaReader) CopyShardingState ¶
func (VersionedSchemaReader) Len ¶
func (s VersionedSchemaReader) Len() int
func (VersionedSchemaReader) MultiTenancy ¶
func (s VersionedSchemaReader) MultiTenancy(ctx context.Context, class string, v uint64, ) (models.MultiTenancyConfig, error)
func (VersionedSchemaReader) Read ¶
func (s VersionedSchemaReader) Read(ctx context.Context, class string, v uint64, reader func(*models.Class, *sharding.State) error, ) error
Read performs a read operation `reader` on the specified class and sharding state
func (VersionedSchemaReader) ReadOnlyClass ¶
func (s VersionedSchemaReader) ReadOnlyClass(ctx context.Context, class string, v uint64, ) (*models.Class, error)
ReadOnlyClass returns a shallow copy of a class. The copy is read-only and should not be modified.
func (VersionedSchemaReader) ShardFromUUID ¶
func (s VersionedSchemaReader) ShardFromUUID(ctx context.Context, class string, uuid []byte, v uint64, ) (string, error)
ShardFromUUID returns shard name of the provided uuid
func (VersionedSchemaReader) ShardOwner ¶
func (s VersionedSchemaReader) ShardOwner(ctx context.Context, class, shard string, v uint64, ) (string, error)
ShardOwner returns the node owner of the specified shard
func (VersionedSchemaReader) ShardReplicas ¶
func (s VersionedSchemaReader) ShardReplicas( ctx context.Context, class, shard string, v uint64, ) ([]string, error)
ShardReplicas returns the replica nodes of a shard