MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / hasEdges

Function hasEdges

worker/mutation.go:356–379  ·  view source on GitHub ↗
(attr string, startTs uint64)

Source from the content-addressed store, hash-verified

354}
355
356func hasEdges(attr string, startTs uint64) bool {
357 pk := x.ParsedKey{Attr: attr}
358 iterOpt := badger.DefaultIteratorOptions
359 iterOpt.PrefetchValues = false
360 iterOpt.Prefix = pk.DataPrefix()
361
362 txn := pstore.NewTransactionAt(startTs, false)
363 defer txn.Discard()
364
365 it := txn.NewIterator(iterOpt)
366 defer it.Close()
367
368 for it.Rewind(); it.Valid(); it.Next() {
369 // NOTE: This is NOT correct.
370 // An incorrect, but efficient way to quickly check if we have at least one non-empty
371 // posting. This does NOT consider those posting lists which can have multiple deltas
372 // summing up to an empty posting list. I'm leaving it as it is for now. But, this could
373 // cause issues because of this inaccuracy.
374 if it.Item().UserMeta()&posting.BitEmptyPosting == 0 {
375 return true
376 }
377 }
378 return false
379}
380func checkSchema(s *pb.SchemaUpdate) error {
381 if s == nil {
382 return errors.Errorf("Nil schema")

Callers 1

checkSchemaFunction · 0.85

Calls 6

DataPrefixMethod · 0.95
NewIteratorMethod · 0.80
ValidMethod · 0.80
ItemMethod · 0.80
CloseMethod · 0.65
NextMethod · 0.45

Tested by

no test coverage detected