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

Method Leader

worker/groups.go:631–644  ·  view source on GitHub ↗

Leader will try to return the leader of a given group, based on membership information. There is currently no guarantee that the returned server is the leader of the group.

(gid uint32)

Source from the content-addressed store, hash-verified

629// Leader will try to return the leader of a given group, based on membership information.
630// There is currently no guarantee that the returned server is the leader of the group.
631func (g *groupi) Leader(gid uint32) *conn.Pool {
632 members := g.members(gid)
633 if members == nil {
634 return nil
635 }
636 for _, m := range members {
637 if m.Leader {
638 if pl, err := conn.GetPools().Get(m.Addr); err == nil {
639 return pl
640 }
641 }
642 }
643 return nil
644}
645
646func (g *groupi) KnownGroups() (gids []uint32) {
647 g.RLock()

Callers 15

connToZeroLeaderMethod · 0.95
handleExportOverNetworkFunction · 0.45
MoveTabletOverNetworkFunction · 0.45
proposeDeleteOrSendFunction · 0.45
getSchemaOverNetworkFunction · 0.45
proposeRestoreOrSendFunction · 0.45
ProposeDrainFunction · 0.45
InStreamFunction · 0.45
UpdateMembershipStateFunction · 0.45
AssignNsIdsOverNetworkFunction · 0.45

Calls 3

membersMethod · 0.95
GetPoolsFunction · 0.92
GetMethod · 0.65

Tested by

no test coverage detected