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

Function run

dgraph/cmd/alpha/run.go:672–908  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

670}
671
672func run() {
673 // keeping this flag for backward compatibility
674 _ = z.NewSuperFlag(Alpha.Conf.GetString("telemetry")).
675 MergeAndCheckDefault(x.TelemetryDefaults)
676
677 bindall = Alpha.Conf.GetBool("bindall")
678 cache := z.NewSuperFlag(Alpha.Conf.GetString("cache")).MergeAndCheckDefault(
679 worker.CacheDefaults)
680 totalCache := cache.GetInt64("size-mb")
681 x.AssertTruef(totalCache >= 0, "ERROR: Cache size must be non-negative")
682
683 cachePercentage := cache.GetString("percentage")
684 removeOnUpdate := cache.GetBool("remove-on-update")
685 cachePercent, err := x.GetCachePercentages(cachePercentage, 3)
686 x.Check(err)
687 postingListCacheSize := (cachePercent[0] * (totalCache << 20)) / 100
688 pstoreBlockCacheSize := (cachePercent[1] * (totalCache << 20)) / 100
689 pstoreIndexCacheSize := (cachePercent[2] * (totalCache << 20)) / 100
690
691 cacheOpts := fmt.Sprintf("blockcachesize=%d; indexcachesize=%d; ",
692 pstoreBlockCacheSize, pstoreIndexCacheSize)
693 bopts := badger.DefaultOptions("").FromSuperFlag(worker.BadgerDefaults + cacheOpts).
694 FromSuperFlag(Alpha.Conf.GetString("badger"))
695 security := z.NewSuperFlag(Alpha.Conf.GetString("security")).MergeAndCheckDefault(
696 worker.SecurityDefaults)
697 conf := audit.GetAuditConf(Alpha.Conf.GetString("audit"))
698
699 x.Config.Limit = z.NewSuperFlag(Alpha.Conf.GetString("limit")).MergeAndCheckDefault(
700 worker.LimitDefaults)
701
702 enableMcp := Alpha.Conf.GetBool("mcp")
703
704 opts := worker.Options{
705 PostingDir: Alpha.Conf.GetString("postings"),
706 WALDir: Alpha.Conf.GetString("wal"),
707 CacheMb: totalCache,
708 CachePercentage: cachePercentage,
709 RemoveOnUpdate: removeOnUpdate,
710
711 MutationsMode: worker.AllowMutations,
712 AuthToken: security.GetString("token"),
713 Audit: conf,
714 ChangeDataConf: Alpha.Conf.GetString("cdc"),
715 TypeFilterUidLimit: x.Config.Limit.GetUint64("type-filter-uid-limit"),
716 }
717
718 keys, err := x.GetEncAclKeys(Alpha.Conf)
719 x.Check(err)
720
721 if keys.AclSecretKey != nil {
722 opts.AclJwtAlg = keys.AclJwtAlg
723 opts.AclSecretKey = keys.AclSecretKey
724 opts.AclSecretKeyBytes = keys.AclSecretKeyBytes
725 opts.AccessJwtTtl = keys.AclAccessTtl
726 opts.RefreshJwtTtl = keys.AclRefreshTtl
727 glog.Info("ACL secret key loaded successfully.")
728 }
729

Callers 1

initFunction · 0.70

Calls 15

AssertTruefFunction · 0.92
GetCachePercentagesFunction · 0.92
CheckFunction · 0.92
GetAuditConfFunction · 0.92
GetEncAclKeysFunction · 0.92
SetConfigurationFunction · 0.92
InitFunction · 0.92
PrintVersionFunction · 0.92
InitServerStateFunction · 0.92
InitTasksFunction · 0.92

Tested by

no test coverage detected