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

Function IsRegisteredReservedPredicate

x/keys.go:754–765  ·  view source on GitHub ↗

IsRegisteredReservedPredicate reports whether pred is owned by a registered ReservedNamespace (by dynamic prefix or exact name). The alter validator and the no-schema mutation guard allow such predicates through even though they are not pre-defined. With no registration it always reports false.

(pred string)

Source from the content-addressed store, hash-verified

752// the no-schema mutation guard allow such predicates through even though they
753// are not pre-defined. With no registration it always reports false.
754func IsRegisteredReservedPredicate(pred string) bool {
755 p := strings.ToLower(ParseAttr(pred))
756 reservedNsMu.RLock()
757 defer reservedNsMu.RUnlock()
758 for _, prefix := range reservedNsPrefixes {
759 if strings.HasPrefix(p, prefix) {
760 return true
761 }
762 }
763 _, ok := reservedNsPredicates[p]
764 return ok
765}
766
767// IsRegisteredReservedType reports whether typ is a type owned by a registered
768// ReservedNamespace. With no registration it always reports false.

Calls 3

ParseAttrFunction · 0.85
RLockMethod · 0.80
RUnlockMethod · 0.80

Used in the wild real call sites across dependent graphs

searching dependent graphs…