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

Function UpdateMembershipState

worker/groups.go:275–289  ·  view source on GitHub ↗

UpdateMembershipState contacts zero for an update on membership state.

(ctx context.Context)

Source from the content-addressed store, hash-verified

273
274// UpdateMembershipState contacts zero for an update on membership state.
275func UpdateMembershipState(ctx context.Context) error {
276 g := groups()
277 p := g.Leader(0)
278 if p == nil {
279 return errors.Errorf("don't have the address of any dgraph zero leader")
280 }
281
282 c := pb.NewZeroClient(p.Get())
283 state, err := c.Connect(ctx, &pb.Member{ClusterInfoOnly: true})
284 if err != nil {
285 return err
286 }
287 g.applyState(g.Node.Id, state.GetState())
288 return nil
289}
290
291func (g *groupi) applyState(myId uint64, state *pb.MembershipState) {
292 x.AssertTrue(state != nil)

Callers 6

ProcessBackupRequestFunction · 0.85
ProcessDeleteNsRequestFunction · 0.85
ProcessRestoreRequestFunction · 0.85
handleRestoreProposalFunction · 0.85
postStreamProcessingFunction · 0.85
leaderBlockingMethod · 0.85

Calls 8

ConnectMethod · 0.95
NewZeroClientFunction · 0.92
groupsFunction · 0.85
applyStateMethod · 0.80
GetMethod · 0.65
LeaderMethod · 0.45
ErrorfMethod · 0.45
GetStateMethod · 0.45

Tested by

no test coverage detected