MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / leaderBlocking

Method leaderBlocking

worker/draft.go:1027–1039  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1025}
1026
1027func (n *node) leaderBlocking() (*conn.Pool, error) {
1028 pool := groups().Leader(groups().groupId())
1029 if pool == nil {
1030 // Functions like retrieveSnapshot and joinPeers are blocking at initial start and
1031 // leader election for a group might not have happened when it is called. If we can't
1032 // find a leader, get latest state from Zero.
1033 if err := UpdateMembershipState(context.Background()); err != nil {
1034 return nil, errors.Errorf("Error while trying to update membership state: %+v", err)
1035 }
1036 return nil, errors.Errorf("Unable to reach leader in group %d", n.gid)
1037 }
1038 return pool, nil
1039}
1040
1041func (n *node) Snapshot() (*pb.Snapshot, error) {
1042 if n == nil || n.Store == nil {

Callers 3

retrieveSnapshotMethod · 0.95
joinPeersMethod · 0.95
isMemberMethod · 0.95

Calls 5

groupsFunction · 0.85
UpdateMembershipStateFunction · 0.85
groupIdMethod · 0.80
LeaderMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected