Remove deepcopy and locks from schemamanager public function
@@ -15,8 +15,6 @@ import (
"context"
"fmt"
- "github.com/semi-technologies/weaviate/entities/deepcopy"
-
"github.com/semi-technologies/weaviate/entities/models"
"github.com/semi-technologies/weaviate/entities/schema"
"github.com/semi-technologies/weaviate/usecases/sharding"
@@ -29,10 +27,8 @@ func (m *Manager) GetSchema(principal *models.Principal) (schema.Schema, error)
return schema.Schema{}, err
}
- m.RLock()
- defer m.RUnlock()
return schema.Schema{
- Objects: deepcopy.Schema(m.state.ObjectSchema),
+ Objects: m.state.ObjectSchema,
}, nil
}
@@ -40,22 +36,18 @@ func (m *Manager) GetSchema(principal *models.Principal) (schema.Schema, error)
// 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 (m *Manager) GetSchemaSkipAuth() schema.Schema {
- m.RLock()
- defer m.RUnlock()
return schema.Schema{
- Objects: deepcopy.Schema(m.state.ObjectSchema),
+ Objects: m.state.ObjectSchema,
}
}
func (m *Manager) getSchema() schema.Schema {
return schema.Schema{
- Objects: deepcopy.Schema(m.state.ObjectSchema),
+ Objects: m.state.ObjectSchema,
}
}
func (m *Manager) IndexedInverted(className, propertyName string) bool {
- m.RLock()
- defer m.RUnlock()
class := m.getClassByName(className)
if class == nil {
return false
@@ -81,9 +73,7 @@ func (m *Manager) GetClass(ctx context.Context, principal *models.Principal,
if err != nil {
return nil, err
}
- m.RLock()
- defer m.RUnlock()
- return deepcopy.Class(m.getClassByName(name)), nil
+ return m.getClassByName(name), nil
}
func (m *Manager) getClassByName(name string) *models.Class {
