MCPcopy Create free account
hub / github.com/brimdata/super / AddVectors

Method AddVectors

db/branch.go:432–458  ·  view source on GitHub ↗
(ctx context.Context, ids []ksuid.KSUID, author, message string)

Source from the content-addressed store, hash-verified

430}
431
432func (b *Branch) AddVectors(ctx context.Context, ids []ksuid.KSUID, author, message string) (ksuid.KSUID, error) {
433 if message == "" {
434 message = vectorMessage("add", ids)
435 }
436 // XXX We should add some parallelism here to stream the next file while
437 // the CPU is chugging away on the current file. See issue #4015.
438 for _, id := range ids {
439 if err := data.CreateVector(ctx, b.pool.engine, b.pool.DataPath, id); err != nil {
440 return ksuid.Nil, err
441 }
442 }
443 return b.commit(ctx, func(parent *branches.Config, retries int) (*commits.Object, error) {
444 snap, err := b.pool.commits.Snapshot(ctx, parent.Commit)
445 if err != nil {
446 return nil, err
447 }
448 for _, id := range ids {
449 if !snap.Exists(id) {
450 return nil, fmt.Errorf("non-existent object %s: vector add operation aborted", id)
451 }
452 if snap.HasVector(id) {
453 return nil, fmt.Errorf("vector exists for %s: vector add operation aborted", id)
454 }
455 }
456 return commits.NewAddVectorsObject(parent.Commit, author, message, ids, retries), nil
457 })
458}
459
460func (b *Branch) DeleteVectors(ctx context.Context, ids []ksuid.KSUID, author, message string) (ksuid.KSUID, error) {
461 if message == "" {

Callers

nothing calls this directly

Calls 7

commitMethod · 0.95
CreateVectorFunction · 0.92
NewAddVectorsObjectFunction · 0.92
vectorMessageFunction · 0.85
ExistsMethod · 0.65
HasVectorMethod · 0.65
SnapshotMethod · 0.45

Tested by

no test coverage detected