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

Function ProcessDeleteNsRequest

worker/multi_tenancy.go:34–60  ·  view source on GitHub ↗
(ctx context.Context, ns uint64)

Source from the content-addressed store, hash-verified

32}
33
34func ProcessDeleteNsRequest(ctx context.Context, ns uint64) error {
35 // Update the membership state to get the latest mapping of groups to predicates.
36 if err := UpdateMembershipState(ctx); err != nil {
37 return errors.Wrapf(err, "Failed to update membership state while deleting namesapce")
38 }
39
40 state := GetMembershipState()
41 g := new(errgroup.Group)
42
43 for gid := range state.Groups {
44 req := &pb.DeleteNsRequest{Namespace: ns, GroupId: gid}
45 g.Go(func() error {
46 return x.RetryUntilSuccess(10, 100*time.Millisecond, func() error {
47 return proposeDeleteOrSend(ctx, req)
48 })
49 })
50 }
51
52 if err := g.Wait(); err != nil {
53 return errors.Wrap(err, "Failed to process delete request")
54 }
55
56 // Now propose the change to zero.
57 return x.RetryUntilSuccess(10, 100*time.Millisecond, func() error {
58 return sendDeleteToZero(ctx, ns)
59 })
60}
61
62func sendDeleteToZero(ctx context.Context, ns uint64) error {
63 gr := groups()

Callers 1

DeleteNamespaceMethod · 0.92

Calls 6

RetryUntilSuccessFunction · 0.92
UpdateMembershipStateFunction · 0.85
GetMembershipStateFunction · 0.85
proposeDeleteOrSendFunction · 0.85
sendDeleteToZeroFunction · 0.85
WaitMethod · 0.80

Tested by

no test coverage detected