Documentation ¶
Overview ¶
package objects provides managers for all kind-related items, such as objects. Manager provides methods for "regular" interaction, such as add, get, delete, update, etc. Additionally BatchManager allows for efficient batch-adding of object instances and references.
Index ¶
- Constants
- type AddReferenceInput
- type BatchDeleteParams
- type BatchDeleteResponse
- type BatchDeleteResult
- type BatchManager
- func (b *BatchManager) AddObjects(ctx context.Context, principal *models.Principal, objects []*models.Object, ...) (BatchObjects, error)
- func (b *BatchManager) AddReferences(ctx context.Context, principal *models.Principal, ...) (BatchReferences, error)
- func (b *BatchManager) DeleteObjects(ctx context.Context, principal *models.Principal, ...) (*BatchDeleteResponse, error)
- type BatchObject
- type BatchObjects
- type BatchReference
- type BatchReferences
- type BatchSimpleObject
- type BatchSimpleObjects
- type BatchVectorRepo
- type DeleteReferenceInput
- type ErrInternal
- type ErrInvalidUserInput
- type ErrNotFound
- type Error
- type Manager
- func (m *Manager) AddObject(ctx context.Context, principal *models.Principal, object *models.Object, ...) (*models.Object, error)
- func (m *Manager) AddObjectReference(ctx context.Context, principal *models.Principal, input *AddReferenceInput, ...) *Error
- func (m *Manager) DeleteObject(ctx context.Context, principal *models.Principal, class string, id strfmt.UUID, ...) error
- func (m *Manager) DeleteObjectReference(ctx context.Context, principal *models.Principal, input *DeleteReferenceInput, ...) *Error
- func (m *Manager) GetObject(ctx context.Context, principal *models.Principal, class string, id strfmt.UUID, ...) (*models.Object, error)
- func (m *Manager) GetObjects(ctx context.Context, principal *models.Principal, offset, limit *int64, ...) ([]*models.Object, error)
- func (m *Manager) GetObjectsClass(ctx context.Context, principal *models.Principal, id strfmt.UUID) (*models.Class, error)
- func (m *Manager) HeadObject(ctx context.Context, principal *models.Principal, class string, id strfmt.UUID, ...) (bool, *Error)
- func (m *Manager) MergeObject(ctx context.Context, principal *models.Principal, updates *models.Object, ...) *Error
- func (m *Manager) Query(ctx context.Context, principal *models.Principal, params *QueryParams) ([]*models.Object, *Error)
- func (m *Manager) UpdateObject(ctx context.Context, principal *models.Principal, class string, id strfmt.UUID, ...) (*models.Object, error)
- func (m *Manager) UpdateObjectReferences(ctx context.Context, principal *models.Principal, input *PutReferenceInput, ...) *Error
- func (m *Manager) ValidateObject(ctx context.Context, principal *models.Principal, obj *models.Object, ...) error
- type MergeDocument
- type Metrics
- func (m *Metrics) AddObjectDec()
- func (m *Metrics) AddObjectInc()
- func (m *Metrics) AddReferenceDec()
- func (m *Metrics) AddReferenceInc()
- func (m *Metrics) AddUsageDimensions(className, queryType, operation string, dims int)
- func (m *Metrics) BatchDec()
- func (m *Metrics) BatchDeleteDec()
- func (m *Metrics) BatchDeleteInc()
- func (m *Metrics) BatchInc()
- func (m *Metrics) BatchOp(op string, startNs int64)
- func (m *Metrics) BatchRefDec()
- func (m *Metrics) BatchRefInc()
- func (m *Metrics) DeleteObjectDec()
- func (m *Metrics) DeleteObjectInc()
- func (m *Metrics) DeleteReferenceDec()
- func (m *Metrics) DeleteReferenceInc()
- func (m *Metrics) GetObjectDec()
- func (m *Metrics) GetObjectInc()
- func (m *Metrics) HeadObjectDec()
- func (m *Metrics) HeadObjectInc()
- func (m *Metrics) MergeObjectDec()
- func (m *Metrics) MergeObjectInc()
- func (m *Metrics) UpdateObjectDec()
- func (m *Metrics) UpdateObjectInc()
- func (m *Metrics) UpdateReferenceDec()
- func (m *Metrics) UpdateReferenceInc()
- type ModulesProvider
- type PutReferenceInput
- type QueryInput
- type QueryParams
- type Replica
- type Replicas
- type VObject
- type VectorRepo
Constants ¶
const ( OutputMinimal = "minimal" OutputVerbose = "verbose" )
const ( StatusForbidden = 403 StatusBadRequest = 400 StatusNotFound = 404 StatusInternalServerError = 500 )
objects status code
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddReferenceInput ¶
type AddReferenceInput struct { // Class name Class string // ID of an object ID strfmt.UUID // Property name Property string // Ref cross reference Ref models.SingleRef }
AddReferenceInput represents required inputs to add a reference to an existing object.
type BatchDeleteParams ¶
type BatchDeleteResponse ¶
type BatchDeleteResponse struct { Match *models.BatchDeleteMatch DryRun bool Output string Params BatchDeleteParams Result BatchDeleteResult }
type BatchDeleteResult ¶
type BatchDeleteResult struct { Matches int64 Limit int64 DryRun bool Objects BatchSimpleObjects }
type BatchManager ¶
type BatchManager struct {
// contains filtered or unexported fields
}
BatchManager manages kind changes in batch at a use-case level , i.e. agnostic of underlying databases or storage providers
func NewBatchManager ¶
func NewBatchManager(vectorRepo BatchVectorRepo, modulesProvider ModulesProvider, locks locks, schemaManager schemaManager, config *config.WeaviateConfig, logger logrus.FieldLogger, authorizer authorizer, prom *monitoring.PrometheusMetrics, ) *BatchManager
NewBatchManager creates a new manager
func (*BatchManager) AddObjects ¶
func (b *BatchManager) AddObjects(ctx context.Context, principal *models.Principal, objects []*models.Object, fields []*string, repl *additional.ReplicationProperties, ) (BatchObjects, error)
AddObjects Class Instances in batch to the connected DB
func (*BatchManager) AddReferences ¶
func (b *BatchManager) AddReferences(ctx context.Context, principal *models.Principal, refs []*models.BatchReference, repl *additional.ReplicationProperties, ) (BatchReferences, error)
AddReferences Class Instances in batch to the connected DB
func (*BatchManager) DeleteObjects ¶
func (b *BatchManager) DeleteObjects(ctx context.Context, principal *models.Principal, match *models.BatchDeleteMatch, dryRun *bool, output *string, repl *additional.ReplicationProperties, ) (*BatchDeleteResponse, error)
DeleteObjects deletes objects in batch based on the match filter
type BatchObject ¶
type BatchObject struct { OriginalIndex int Err error Object *models.Object UUID strfmt.UUID Vector []float32 }
BatchObject is a helper type that groups all the info about one object in a batch that belongs together, i.e. uuid, object body and error state.
Consumers of an Object (i.e. database connector) should always check whether an error is already present by the time they receive a batch object. Errors can be introduced at all levels, e.g. validation.
However, error'd objects are not removed to make sure that the list in Objects matches the order and content of the incoming batch request
type BatchObjects ¶
type BatchObjects []BatchObject
BatchObjects groups many Object items together. The order matches the order from the original request. It can be turned into the expected response type using the .Response() method
type BatchReference ¶
type BatchReference struct { OriginalIndex int `json:"originalIndex"` Err error `json:"err"` From *crossref.RefSource `json:"from"` To *crossref.Ref `json:"to"` }
BatchReference is a helper type that groups all the info about one references in a batch that belongs together, i.e. from, to, original index and error state
Consumers of an Object (i.e. database connector) should always check whether an error is already present by the time they receive a batch object. Errors can be introduced at all levels, e.g. validation.
However, error'd objects are not removed to make sure that the list in Objects matches the order and content of the incoming batch request
type BatchReferences ¶
type BatchReferences []BatchReference
BatchReferences groups many Reference items together. The order matches the order from the original request. It can be turned into the expected response type using the .Response() method
type BatchSimpleObject ¶
type BatchSimpleObjects ¶
type BatchSimpleObjects []BatchSimpleObject
type BatchVectorRepo ¶
type BatchVectorRepo interface { VectorRepo // contains filtered or unexported methods }
type DeleteReferenceInput ¶
type DeleteReferenceInput struct { // Class name Class string // ID of an object ID strfmt.UUID // Property name Property string // Reference cross reference Reference models.SingleRef }
DeleteReferenceInput represents required inputs to delete a reference from an existing object.
type ErrInternal ¶
type ErrInternal struct {
// contains filtered or unexported fields
}
ErrInternal indicates something went wrong during processing
func NewErrInternal ¶
func NewErrInternal(format string, args ...interface{}) ErrInternal
NewErrInternal with Errorf signature
func (ErrInternal) Error ¶
func (e ErrInternal) Error() string
type ErrInvalidUserInput ¶
type ErrInvalidUserInput struct {
// contains filtered or unexported fields
}
ErrInvalidUserInput indicates a client-side error
func NewErrInvalidUserInput ¶
func NewErrInvalidUserInput(format string, args ...interface{}) ErrInvalidUserInput
NewErrInvalidUserInput with Errorf signature
func (ErrInvalidUserInput) Error ¶
func (e ErrInvalidUserInput) Error() string
type ErrNotFound ¶
type ErrNotFound struct {
// contains filtered or unexported fields
}
ErrNotFound indicates the desired resource doesn't exist
func NewErrNotFound ¶
func NewErrNotFound(format string, args ...interface{}) ErrNotFound
NewErrNotFound with Errorf signature
func (ErrNotFound) Error ¶
func (e ErrNotFound) Error() string
type Error ¶
func (*Error) BadRequest ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages kind changes at a use-case level, i.e. agnostic of underlying databases or storage providers
func NewManager ¶
func NewManager(locks locks, schemaManager schemaManager, config *config.WeaviateConfig, logger logrus.FieldLogger, authorizer authorizer, vectorRepo VectorRepo, modulesProvider ModulesProvider, metrics objectsMetrics, ) *Manager
NewManager creates a new manager
func (*Manager) AddObject ¶
func (m *Manager) AddObject(ctx context.Context, principal *models.Principal, object *models.Object, repl *additional.ReplicationProperties, ) (*models.Object, error)
AddObject Class Instance to the connected DB.
func (*Manager) AddObjectReference ¶
func (m *Manager) AddObjectReference( ctx context.Context, principal *models.Principal, input *AddReferenceInput, repl *additional.ReplicationProperties, ) *Error
AddObjectReference to an existing object. If the class contains a network ref, it has a side-effect on the schema: The schema will be updated to include this particular network ref class.
func (*Manager) DeleteObject ¶
func (m *Manager) DeleteObject(ctx context.Context, principal *models.Principal, class string, id strfmt.UUID, repl *additional.ReplicationProperties, ) error
DeleteObject Class Instance from the conncected DB
if class == "" it will delete all object with same id regardless of the class name. This is due to backward compatibility reasons and should be removed in the future
func (*Manager) DeleteObjectReference ¶
func (m *Manager) DeleteObjectReference( ctx context.Context, principal *models.Principal, input *DeleteReferenceInput, repl *additional.ReplicationProperties, ) *Error
func (*Manager) GetObject ¶
func (m *Manager) GetObject(ctx context.Context, principal *models.Principal, class string, id strfmt.UUID, additional additional.Properties, replProps *additional.ReplicationProperties, ) (*models.Object, error)
GetObject Class from the connected DB
func (*Manager) GetObjects ¶
func (m *Manager) GetObjects(ctx context.Context, principal *models.Principal, offset, limit *int64, sort, order *string, after *string, additional additional.Properties, ) ([]*models.Object, error)
GetObjects Class from the connected DB
func (*Manager) GetObjectsClass ¶
func (*Manager) HeadObject ¶
func (m *Manager) HeadObject(ctx context.Context, principal *models.Principal, class string, id strfmt.UUID, repl *additional.ReplicationProperties, ) (bool, *Error)
HeadObject check object's existence in the conncected DB
func (*Manager) MergeObject ¶
func (m *Manager) MergeObject(ctx context.Context, principal *models.Principal, updates *models.Object, repl *additional.ReplicationProperties, ) *Error
func (*Manager) UpdateObject ¶
func (m *Manager) UpdateObject(ctx context.Context, principal *models.Principal, class string, id strfmt.UUID, updates *models.Object, repl *additional.ReplicationProperties, ) (*models.Object, error)
UpdateObject updates object of class. If the class contains a network ref, it has a side-effect on the schema: The schema will be updated to include this particular network ref class.
func (*Manager) UpdateObjectReferences ¶
func (m *Manager) UpdateObjectReferences( ctx context.Context, principal *models.Principal, input *PutReferenceInput, repl *additional.ReplicationProperties, ) *Error
UpdateObjectReferences of a specific data object. If the class contains a network ref, it has a side-effect on the schema: The schema will be updated to include this particular network ref class.
func (*Manager) ValidateObject ¶
func (m *Manager) ValidateObject(ctx context.Context, principal *models.Principal, obj *models.Object, repl *additional.ReplicationProperties, ) error
ValidateObject without adding it to the database. Can be used in UIs for async validation before submitting
type MergeDocument ¶
type MergeDocument struct { Class string `json:"class"` ID strfmt.UUID `json:"id"` PrimitiveSchema map[string]interface{} `json:"primitiveSchema"` References BatchReferences `json:"references"` Vector []float32 `json:"vector"` UpdateTime int64 `json:"updateTime"` AdditionalProperties models.AdditionalProperties `json:"additionalProperties"` PropertiesToDelete []string `json:"propertiesToDelete"` }
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶
func NewMetrics(prom *monitoring.PrometheusMetrics) *Metrics
func (*Metrics) AddObjectDec ¶
func (m *Metrics) AddObjectDec()
func (*Metrics) AddObjectInc ¶
func (m *Metrics) AddObjectInc()
func (*Metrics) AddReferenceDec ¶
func (m *Metrics) AddReferenceDec()
func (*Metrics) AddReferenceInc ¶
func (m *Metrics) AddReferenceInc()
func (*Metrics) AddUsageDimensions ¶
func (*Metrics) BatchDeleteDec ¶
func (m *Metrics) BatchDeleteDec()
func (*Metrics) BatchDeleteInc ¶
func (m *Metrics) BatchDeleteInc()
func (*Metrics) BatchRefDec ¶
func (m *Metrics) BatchRefDec()
func (*Metrics) BatchRefInc ¶
func (m *Metrics) BatchRefInc()
func (*Metrics) DeleteObjectDec ¶
func (m *Metrics) DeleteObjectDec()
func (*Metrics) DeleteObjectInc ¶
func (m *Metrics) DeleteObjectInc()
func (*Metrics) DeleteReferenceDec ¶
func (m *Metrics) DeleteReferenceDec()
func (*Metrics) DeleteReferenceInc ¶
func (m *Metrics) DeleteReferenceInc()
func (*Metrics) GetObjectDec ¶
func (m *Metrics) GetObjectDec()
func (*Metrics) GetObjectInc ¶
func (m *Metrics) GetObjectInc()
func (*Metrics) HeadObjectDec ¶
func (m *Metrics) HeadObjectDec()
func (*Metrics) HeadObjectInc ¶
func (m *Metrics) HeadObjectInc()
func (*Metrics) MergeObjectDec ¶
func (m *Metrics) MergeObjectDec()
func (*Metrics) MergeObjectInc ¶
func (m *Metrics) MergeObjectInc()
func (*Metrics) UpdateObjectDec ¶
func (m *Metrics) UpdateObjectDec()
func (*Metrics) UpdateObjectInc ¶
func (m *Metrics) UpdateObjectInc()
func (*Metrics) UpdateReferenceDec ¶
func (m *Metrics) UpdateReferenceDec()
func (*Metrics) UpdateReferenceInc ¶
func (m *Metrics) UpdateReferenceInc()
type ModulesProvider ¶
type ModulesProvider interface { GetObjectAdditionalExtend(ctx context.Context, in *search.Result, moduleParams map[string]interface{}) (*search.Result, error) ListObjectsAdditionalExtend(ctx context.Context, in search.Results, moduleParams map[string]interface{}) (search.Results, error) UsingRef2Vec(className string) bool UpdateVector(ctx context.Context, object *models.Object, class *models.Class, objectDiff *moduletools.ObjectDiff, repo modulecapabilities.FindObjectFn, logger logrus.FieldLogger) error VectorizerName(className string) (string, error) }
type PutReferenceInput ¶
type PutReferenceInput struct { // Class name Class string // ID of an object ID strfmt.UUID // Property name Property string // Ref cross reference Refs models.MultipleRef }
PutReferenceInput represents required inputs to add a reference to an existing object.
type QueryInput ¶
type QueryInput struct { Class string Offset int Limit int Cursor *filters.Cursor Filters *filters.LocalFilter Sort []filters.Sort Additional additional.Properties }
type QueryParams ¶
type QueryParams struct { Class string Offset *int64 Limit *int64 After *string Sort *string Order *string Additional additional.Properties }
type Replica ¶ added in v1.18.0
type Replica struct { ID strfmt.UUID `json:"id,omitempty"` Deleted bool `json:"deleted"` Object *storobj.Object `json:"object,omitempty"` }
Replica represents a replicated data item
func (*Replica) MarshalBinary ¶ added in v1.18.0
func (*Replica) UnmarshalBinary ¶ added in v1.18.0
func (Replica) UpdateTime ¶ added in v1.18.0
UpdateTime return update time if it exists and 0 otherwise
type Replicas ¶ added in v1.18.0
type Replicas []Replica
func (Replicas) MarshalBinary ¶ added in v1.18.0
func (*Replicas) UnmarshalBinary ¶ added in v1.18.0
type VObject ¶ added in v1.18.0
type VObject struct { // LatestObject is to most up-to-date version of an object LatestObject *models.Object `json:"object,omitempty"` // StaleUpdateTime is the LastUpdateTimeUnix of the stale object sent to the coordinator StaleUpdateTime int64 `json:"updateTime,omitempty"` // Version is the most recent incremental version number of the object Version uint64 `json:"version"` }
VObject is a versioned object for detecting replication inconsistencies
func (*VObject) MarshalBinary ¶ added in v1.18.0
func (*VObject) UnmarshalBinary ¶ added in v1.18.0
type VectorRepo ¶
type VectorRepo interface { PutObject(ctx context.Context, concept *models.Object, vector []float32, repl *additional.ReplicationProperties) error DeleteObject(ctx context.Context, className string, id strfmt.UUID, repl *additional.ReplicationProperties) error // Object returns object of the specified class giving by its id Object(ctx context.Context, class string, id strfmt.UUID, props search.SelectProperties, additional additional.Properties, repl *additional.ReplicationProperties) (*search.Result, error) // Exists returns true if an object of a giving class exists Exists(ctx context.Context, class string, id strfmt.UUID, repl *additional.ReplicationProperties) (bool, error) ObjectByID(ctx context.Context, id strfmt.UUID, props search.SelectProperties, additional additional.Properties) (*search.Result, error) ObjectSearch(ctx context.Context, offset, limit int, filters *filters.LocalFilter, sort []filters.Sort, additional additional.Properties) (search.Results, error) AddReference(ctx context.Context, className string, source strfmt.UUID, propName string, ref *models.SingleRef, repl *additional.ReplicationProperties) error Merge(ctx context.Context, merge MergeDocument, repl *additional.ReplicationProperties) error Query(context.Context, *QueryInput) (search.Results, *Error) }
Source Files ¶
- add.go
- auto_schema.go
- batch_add.go
- batch_delete.go
- batch_helper.go
- batch_manager.go
- batch_references_add.go
- batch_types.go
- delete.go
- errors.go
- get.go
- head.go
- manager.go
- merge.go
- metrics.go
- query.go
- references_add.go
- references_delete.go
- references_update.go
- replication.go
- update.go
- validate.go
- vector.go