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

Method AmLeader

dgraph/cmd/zero/raft.go:64–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62}
63
64func (n *node) AmLeader() bool {
65 // Return false if the node is not the leader. Otherwise, check the lastQuorum as well.
66 if !n.amLeader() {
67 return false
68 }
69 // This node must be the leader, but must also be an active member of
70 // the cluster, and not hidden behind a partition. Basically, if this
71 // node was the leader and goes behind a partition, it would still
72 // think that it is indeed the leader for the duration mentioned below.
73 n.mu.RLock()
74 defer n.mu.RUnlock()
75 return time.Since(n.lastQuorum) <= 5*time.Second
76}
77
78// {2 bytes Node ID} {4 bytes for random} {2 bytes zero}
79func (n *node) initProposalKey(id uint64) error {

Callers 13

proposeAndWaitMethod · 0.95
regenerateChecksumMethod · 0.95
moveTabletMethod · 0.45
leaseMethod · 0.45
AssignIdsMethod · 0.45
CommitOrAbortMethod · 0.45
OracleMethod · 0.45
MoveTabletMethod · 0.45
movePredicateMethod · 0.45

Calls 3

amLeaderMethod · 0.95
RLockMethod · 0.80
RUnlockMethod · 0.80

Tested by

no test coverage detected