MCPcopy
hub / github.com/weaviate/weaviate / DeleteObject

Method DeleteObject

usecases/replica/replicator.go:168–200  ·  view source on GitHub ↗
(ctx context.Context,
	shard string,
	id strfmt.UUID,
	deletionTime time.Time,
	l types.ConsistencyLevel,
	schemaVersion uint64,
)

Source from the content-addressed store, hash-verified

166}
167
168func (r *Replicator) DeleteObject(ctx context.Context,
169 shard string,
170 id strfmt.UUID,
171 deletionTime time.Time,
172 l types.ConsistencyLevel,
173 schemaVersion uint64,
174) error {
175 coord := NewWriteCoordinator[SimpleResponse, error](r.client, r.router, r.metrics, r.class, shard, r.requestID(opDeleteObject), r.log)
176 release := r.inflight.register(shard)
177 defer release()
178 op := func(ctx context.Context, host, requestID string) error {
179 resp, err := r.client.DeleteObject(ctx, host, r.class, shard, requestID, id, deletionTime, schemaVersion)
180 if err == nil {
181 err = resp.FirstError()
182 }
183 if err != nil {
184 return fmt.Errorf("%q: %w", host, err)
185 }
186 return nil
187 }
188 rs, err := coord.Push(ctx, l, op, r.simpleCommit(shard), r.readSimpleResponse, r.flattenErrors, 1)
189 if err != nil {
190 r.log.WithField("op", "push.delete").WithField("class", r.class).
191 WithField("shard", shard).Error(err)
192 return fmt.Errorf("%s %q: %w", replicaerrors.MsgCLevel, l, replicaerrors.NewNotEnoughReplicasError(err))
193 }
194 if err := firstError(rs); err != nil {
195 r.log.WithField("op", "put").WithField("class", r.class).
196 WithField("shard", shard).WithField("uuid", id).Error(err)
197 return err
198 }
199 return nil
200}
201
202func (r *Replicator) PutObjects(ctx context.Context,
203 shard string,

Callers

nothing calls this directly

Calls 10

requestIDMethod · 0.95
simpleCommitMethod · 0.95
NewWriteCoordinatorFunction · 0.85
firstErrorFunction · 0.85
registerMethod · 0.80
ErrorfMethod · 0.80
DeleteObjectMethod · 0.65
FirstErrorMethod · 0.45
PushMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected