MCPcopy
hub / github.com/dgraph-io/dgraph / upsertGuardianAndGroot

Function upsertGuardianAndGroot

edgraph/access.go:431–459  ·  view source on GitHub ↗

Note: The handling of closer should be done by caller.

(closer *z.Closer, ns uint64)

Source from the content-addressed store, hash-verified

429
430// Note: The handling of closer should be done by caller.
431func upsertGuardianAndGroot(closer *z.Closer, ns uint64) {
432 if worker.Config.AclSecretKey == nil {
433 // The acl feature is not turned on.
434 return
435 }
436 for closer.Ctx().Err() == nil {
437 ctx, cancel := context.WithTimeout(closer.Ctx(), time.Minute)
438 defer cancel()
439 ctx = x.AttachNamespace(ctx, ns)
440 if err := upsertGuardian(ctx); err != nil {
441 glog.Infof("Unable to upsert the guardian group. Error: %v", err)
442 time.Sleep(100 * time.Millisecond)
443 continue
444 }
445 break
446 }
447
448 for closer.Ctx().Err() == nil {
449 ctx, cancel := context.WithTimeout(closer.Ctx(), time.Minute)
450 defer cancel()
451 ctx = x.AttachNamespace(ctx, ns)
452 if err := upsertGroot(ctx, "password"); err != nil {
453 glog.Infof("Unable to upsert the groot account. Error: %v", err)
454 time.Sleep(100 * time.Millisecond)
455 continue
456 }
457 break
458 }
459}
460
461// upsertGuardian must be called after setting the namespace in the context.
462func upsertGuardian(ctx context.Context) error {

Callers 2

alterMethod · 0.85
InitializeAclFunction · 0.85

Calls 5

AttachNamespaceFunction · 0.92
upsertGuardianFunction · 0.85
upsertGrootFunction · 0.85
InfofMethod · 0.80
CtxMethod · 0.45

Tested by

no test coverage detected