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

Method Init

dgraph/cmd/zero/zero.go:71–99  ·  view source on GitHub ↗

Init initializes the zero server.

()

Source from the content-addressed store, hash-verified

69
70// Init initializes the zero server.
71func (s *Server) Init() {
72 s.Lock()
73 defer s.Unlock()
74
75 s.orc = &Oracle{}
76 s.orc.Init()
77 s.state = &pb.MembershipState{
78 Groups: make(map[uint32]*pb.Group),
79 Zeros: make(map[uint64]*pb.Member),
80 }
81 s.nextUint = make(map[pb.NumLeaseType]uint64)
82 s.nextRaftId = 1
83 s.nextUint[pb.Num_UID] = 1
84 s.nextUint[pb.Num_TXN_TS] = 1
85 s.nextUint[pb.Num_NS_ID] = 1
86 s.nextGroup = 1
87 s.leaderChangeCh = make(chan struct{}, 1)
88 s.closer = z.NewCloser(2) // grpc and http
89 s.blockCommitsOn = new(sync.Map)
90 s.moveOngoing = make(chan struct{}, 1)
91 s.checkpointPerGroup = make(map[uint32]uint64)
92 if opts.limiterConfig.UidLeaseLimit > 0 {
93 // rate limiting is not enabled when lease limit is set to zero.
94 s.rateLimiter = x.NewRateLimiter(int64(opts.limiterConfig.UidLeaseLimit),
95 opts.limiterConfig.RefillAfter, s.closer)
96 }
97
98 go s.rebalanceTablets()
99}
100
101func (s *Server) periodicallyPostTelemetry() {
102 const scarfBaseUrlFmt = "https://events.dgraph.io/dgraph-deployments/%v/%v/%v/%v/%v"

Callers 1

serveGRPCMethod · 0.45

Calls 4

rebalanceTabletsMethod · 0.95
NewRateLimiterFunction · 0.92
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected