MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / HasCount

Method HasCount

schema/schema.go:452–465  ·  view source on GitHub ↗

HasCount returns whether we want to mantain a count index for the given predicate or not.

(ctx context.Context, pred string)

Source from the content-addressed store, hash-verified

450
451// HasCount returns whether we want to mantain a count index for the given predicate or not.
452func (s *state) HasCount(ctx context.Context, pred string) bool {
453 isWrite, _ := ctx.Value(IsWrite).(bool)
454 s.RLock()
455 defer s.RUnlock()
456 if isWrite {
457 if schema, ok := s.mutSchema[pred]; ok && schema.Count {
458 return true
459 }
460 }
461 if schema, ok := s.predicate[pred]; ok {
462 return schema.Count
463 }
464 return false
465}
466
467func (s *state) PredicatesToDelete(pred string) []string {
468 s.RLock()

Callers 4

handleDeleteAllMethod · 0.80
AddMutationWithIndexMethod · 0.80

Calls 3

RLockMethod · 0.80
RUnlockMethod · 0.80
ValueMethod · 0.45

Tested by

no test coverage detected