View Javadoc
1   /*
2    * Copyright 2021 TiKV Project Authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   */
17  
18  package org.tikv.common.util;
19  
20  import com.google.protobuf.ByteString;
21  import org.tikv.common.region.TiRegion;
22  
23  public class DeleteRange {
24    private final BackOffer backOffer;
25    private final TiRegion region;
26    private final ByteString startKey;
27    private final ByteString endKey;
28  
29    public DeleteRange(BackOffer backOffer, TiRegion region, ByteString startKey, ByteString endKey) {
30      this.backOffer = ConcreteBackOffer.create(backOffer);
31      this.region = region;
32      this.startKey = startKey;
33      this.endKey = endKey;
34    }
35  
36    public BackOffer getBackOffer() {
37      return backOffer;
38    }
39  
40    public TiRegion getRegion() {
41      return region;
42    }
43  
44    public ByteString getStartKey() {
45      return startKey;
46    }
47  
48    public ByteString getEndKey() {
49      return endKey;
50    }
51  
52    @Override
53    public String toString() {
54      return KeyRangeUtils.makeRange(getStartKey(), getEndKey()).toString();
55    }
56  }