Skip to content

Commit

Permalink
Implement DropKeyRange && DropAllKeyRanges in coordinator grpc service
Browse files Browse the repository at this point in the history
  • Loading branch information
reshke committed Apr 2, 2024
1 parent 7ce9989 commit bc7f5d3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions coordinator/provider/keyranges.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,28 @@ type CoordinatorService struct {
impl coordinator.Coordinator
}

// DropAllKeyRanges implements proto.KeyRangeServiceServer.
func (c *CoordinatorService) DropAllKeyRanges(ctx context.Context, request *protos.DropAllKeyRangesRequest) (*protos.DropAllKeyRangesResponse, error) {
err := c.impl.DropKeyRangeAll(ctx)
if err != nil {
return nil, err
}

return &protos.DropAllKeyRangesResponse{}, nil
}

// DropKeyRange implements proto.KeyRangeServiceServer.
func (c *CoordinatorService) DropKeyRange(ctx context.Context, request *protos.DropKeyRangeRequest) (*protos.ModifyReply, error) {
for _, id := range request.Id {
err := c.impl.DropKeyRange(ctx, id)
if err != nil {
return nil, err
}
}

return &protos.ModifyReply{}, nil
}

// TODO : unit tests
func (c *CoordinatorService) CreateKeyRange(ctx context.Context, request *protos.CreateKeyRangeRequest) (*protos.ModifyReply, error) {
err := c.impl.CreateKeyRange(ctx, kr.KeyRangeFromProto(request.KeyRangeInfo))
Expand Down

0 comments on commit bc7f5d3

Please sign in to comment.