(ctx context.Context, ns uint64)
| 32 | } |
| 33 | |
| 34 | func 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 | |
| 62 | func sendDeleteToZero(ctx context.Context, ns uint64) error { |
| 63 | gr := groups() |
no test coverage detected